Search code examples
command-promptadministrator

How do I run a program from command prompt as a different user and as an admin


I am using "runas" to open command prompt as a different user but that command prompt is not running as an admin. How can I make it run as an admin?

UPDATE: I am using Windows Server 2012

UPDATE: I opened cmd for another account by running

 runas /user:domain\username cmd.exe

Then I tried to run some commands in this new prompt but this is not running as an elevated user (even though it has Administrator privileges).


Solution

  • See here: https://superuser.com/questions/42537/is-there-any-sudo-command-for-windows

    According to that the command looks like this for admin:

     runas /noprofile /user:Administrator cmd