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

I want to run a batch file as a different user, via the Windows -> Run dialogue.

I have tried:

runas /profile /user:test CMD "C:\Users\MyName\Desktop\Run.bat"

runas /profile /user:test "CMD "C:\Users\MyName\Desktop\Run.bat""

runas /profile /user:test "CMD \"C:\Users\MyName\Desktop\Run.bat\""

runas /profile /user:test "CMD \"C:\Users\MyName\Desktop\Run.bat"\"

but still no luck. It opens up CMD and asks me for my password. I enter it, and it opens another CMD window using the other username, but it doesn't run the bat. Instead, the title bar just says

Administrator: cmd "C:\Users\MyName\Desktop\Run.bat" (running as Home-PC\test)

Can anyone please help?

share|improve this question
Do you want to run this as a one-time thing, or something repeatedly for different users? – Geo Apr 26 '12 at 20:44
I would like to run this as the system administrator, once a day. the batch file reaches out to a server to get updates for a program that I have. – Eric K. Apr 27 '12 at 13:15

Your missing a switch. From CMD /?:

/C      Carries out the command specified by string and then terminates
/K      Carries out the command specified by string but remains

These commands should work. Choose the one that suits your needs.

runas /profile /user:test "CMD /C C:\Users\MyName\Desktop\Run.bat"

runas /profile /user:test "CMD /K C:\Users\MyName\Desktop\Run.bat"

If the path contains spaces, surround it with escaped double quotes (\"):

runas /profile /user:test "CMD /C \"C:\Users\My Name\Desktop\Run.bat\""

runas /profile /user:test "CMD /K \"C:\Users\My Name\Desktop\Run.bat\""
share|improve this answer
Thank you Dennis, I will try this and get back to you. – Eric K. Apr 27 '12 at 13:15
@EricK. Did it work for you? If so, it'd be great if you mark this as the answer so we know that a solution found :) – Jeff Bridgman Oct 10 '12 at 17:06
These instructions are wrong. You cannot specify any arguments to the program you wish to run with runas. More information here. – Nicole Hamilton Mar 4 '13 at 15:35
@NicoleHamilton: My syntax was wrong (I only focused on the missing switch), but you can pass arguments to the command. runas /? actually shows two examples. I've tested the two commands in my (edited) answer, and they work. – Dennis Mar 4 '13 at 15:57
Okay, I agree, that fixes it. – Nicole Hamilton Mar 4 '13 at 16:02

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.