Starting services in batch file on windows 7

Posted by Dima on Super User See other posts from Super User or by Dima
Published on 2011-01-22T11:08:15Z Indexed on 2012/03/19 23:32 UTC
Read the original article Hit count: 245

Filed under:
|
|

I have a fairly simple batch file which does just one thing - "net start myservice". This batch file gets shortcut-ed in a program group by installer so that users can simply click on the icon and get things started (or stopped). All works well in XP for the users with admin rights. But things get hairy on Win7 as the batch need to be run "as administrator" explicitly and often users don't know this. So my question is how to make this friendly? Telling users to right click and run as admin on Win7 and simply click on XP is kind of weird twist. I need a smart automatic simple thingy.

I could probably use "runas/user:administrator" in the batch itself, but this "administrator" account might not be available on some machines. I'm looking for a universal solution for installing things like this on any Windows box.

Ideas? How would you do this?

© Super User or respective owner

Related posts about windows-7

Related posts about privileges