Sign up ×
Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

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?

share|improve this question

marked as duplicate by Sathya, Gilles, CarlF, nhinkle, BinaryMisfit Nov 12 '10 at 7:09

This question has been asked before and already has an answer. If those answers do not fully address your question, please ask a new question.

4 Answers 4

up vote 17 down vote accepted

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

share|improve this answer
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
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
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 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 at 21:08

Runas is a pretty functional equivalent.

share|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.)

share|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.

share|improve this answer

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