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

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

In Win7, a user can right-click on a program and choose 'Run as administrator'. You get a popup, but do not have to enter the administrator password.

I would like to get the same functionality, but from the commandline - in particular, from inside a .bat file.

I am aware of the built-in runas command, but I have not found a way to use that that doesn't end up asking for a password at some point.

I am also aware of the Process.StartInfo.Verb = "runas"; method, which does exactly what I want, but requires me creating a custom .NET app.

Is there any way, using only built-in commandline tools in Win7, to accomplish this?

Update: Thanks to uSlackr, I worked out this command:

powershell Start-Process cmd.exe -Verb RunAs

Of course, the cmd.exe is just a placeholder.

share|improve this question
up vote 4 down vote accepted

You can use the Start-Process cmdlet in Powershell with the RunAs verb. More here:

share|improve this answer
Perfect, thank you. I updated the question with a working example. – jwd May 3 '12 at 23:56
Any equivalent on Windows XP? – Maxbester Jun 7 '13 at 12:31
Powershell is available for XP. – uSlackr Jun 7 '13 at 19:19
XP doesn't have UAC so the question is not relevant to it – nponeccop Dec 6 '14 at 1:20

Simply run the cmd.exe as administrator.

The keyboard shortcut for this is [shift] + [enter] after you have selected the commandline from the start menu. A UAC window should pop up.


Run everything as Admin

Not recommended for everyday usage, but there is also a built in administrator account that you can activate in windows that will simply run any and all applications as root. In an administrative cmd:

net user administrator /active:yes

Change that to '/active:no' if you want to disable the account. A brief intro here.

share|improve this answer
Regarding your first suggestion: Sorry, I was not clear. I want to do this from inside a .bat file (question updated). – jwd May 3 '12 at 23:50
Regarding your second suggestion: I ran this, and got "System error 5 has occurred. Access is denied." – jwd May 3 '12 at 23:50
Even running cmd.exe as admin? – A. Hayes May 4 '12 at 21:59
The whole point of this question is that I am running this command as a non-admin user and I want to temporarily elevate permissions. – jwd May 5 '12 at 1:37

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

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