How to run a command as administrator in Windows?

0

Possible Duplicate:
is there any ‘Sudo’ command for windows ?

I want to run a console program in Windows, but it required administrative privileges. So, I can right click the command prompt to run as administrator, but I want to use something from the command line to elevate the program.

Is there something like sudo in Windows?

user37622

Posted 2010-05-19T07:24:08.103

Reputation:

Question was closed 2010-05-19T11:53:05.910

1http://superuser.com/questions/42537/is-there-any-sudo-command-for-windows – Blorgbeard is out – 2010-05-19T07:45:42.683

@Blorgbeard: My answer isn't in that other question, so not exactly a dup. – harrymc – 2010-05-19T09:14:57.250

Answers

3

Or use runas, supplied with Windows:

Runas /user:administrator notepad

Or you can have a batch file (say myrunas.bat) that contains:

Runas /user:administrator %*

%* means "all parameters".
Used, for example, as:

myrunas notepad

harrymc

Posted 2010-05-19T07:24:08.103

Reputation: 306 093