How to run a command as administrator in Windows?

6,765

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
Share:
6,765
Community
Author by

Community

Updated on September 17, 2022

Comments

  • Community
    Community over 1 year

    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?