Possible Duplicate:
is there any 'Sudo' command for windows ?

Is there a command line equivalent to sudo in Windows 7? Or do you just have to open a command prompt that is being run as administrator?


The runas command is the equivelent of sudo in windows 7.

runas [{/profile|/noprofile}] [/env] [/netonly] [/smartcard] [/showtrustlevels] [/trustlevel] /user:UserAccountName program

Run the following command to start a command shell as an administrator. EDIT: Or you could right click the command prompt and click Run As Administrator.

runas /noprofile /user:Administrator cmd
| improve this answer | |
  • 7
    I think it's quite common, but notice that sudo is different than su in the way that you can setup a sudo user to be able to only run a specific application as root with its own password, while su requires the user to enter the actual root password. runas is the same as su, not sudo. – Filipe Pina Apr 19 '12 at 22:14
  • 1
    Not an equivalent, runas does not allow as user to run a known application as superuser... – MUY Belgium Oct 13 '14 at 8:10
  • Hi @MUYBelgium, you are correct. I do know this now, but There is no other method for doing anything remotely close in Windows unfortunately. I do need something like this currently, but there is no solution. This is the closest method... – David Oct 13 '14 at 20:23
  • 1
    Sorry, this answer is just wrong. For sudo I could use my normal user password, just like on Windows if a program asks for elevated rights. In your example I need to know the admin password. Ergo, runas is by no means an equivalent for sudo. – kriegaex Jul 29 '15 at 6:06
  • This appears to be the closest thing to sudo in Windows. What option do you use as an equivalence to sudo while in Windows? If you look at the previous comments on the answer, you will see where I already addressed a similar opinion. – David Jul 29 '15 at 21:08

Runas is a pretty functional equivalent.

| improve this answer | |

It's easiest to run CMD as administrator (or elevated, in the case of standalone desktop Windows), but there is the runas command as well.

| improve this answer | |

The failure IMO with runas is that when used, you are "running as" a different user. Different environment, different sets of defaults ...

A BIG TIME failure for me.

SuRun - SUDO in Windows states:

The best part is - SuRun will elevate the privileges for the CURRENT user account! It will not try to run programs as another, administrator account. This means all registry entries and file system paths will be correct, just as the user expects them!

(I have not tried it - yet. Cannot believe they way MS has implemented elevation & that I may have to resort to a third party program to have things work they way they should have in the first place.)

| improve this answer | |

Not the answer you're looking for? Browse other questions tagged or ask your own question.