I am trying to start Performance monitor as different user. I found runas.exe but syntax for program arguments makes me go crazy. The following syntax works:

C:\Windows\System32\runas.exe /user:domain\username perfmon.exe

But since perfmon.exe has the argument /res the following line doesn't work:

C:\Windows\System32\runas.exe /user:domain\username perfmon.exe /res

I tried to escape /res but without any success. I tried:


Any ideas?

  • The answer below is correct. This is just an example: C:\Windows\System32\runas.exe /user:yourusername "perfmon.exe /res" – Epoxy Mar 21 '18 at 10:11

The correct syntax is to include both the target executable and its parameters in double quotes like this:

runas.exe /user:domain\username "perfmon.exe /res"

runas.exe /user:domain\username "perfmon.exe \"argument with spaces\" /res"

More Information

| improve this answer | |
  • What if the arguments contain spaces? how do you escape quotes around each argument? Just tried with \" and it worked – Adam Jan 11 '19 at 19:26
  • Feel free to edit the answer if you'd like to expand on that! – I say Reinstate Monica Jan 11 '19 at 20:58

For anyone stumbling upon this while searching for a way to use runas with an application where its own parameters may contain spaces.

The original accepted answer with \" did not work for me.

What works is to put a double quote to actually be able to pass arguments with spaces:

runas.exe /user:domain\username "perfmon.exe ""argument with spaces"" /res"

It is actually explained quite nicely here: https://ss64.com/nt/syntax-esc.html

| improve this answer | |

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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