Run as different user and elevate

Within Windows Explorer, I can right click on an executable file and pick 'Run as administrator' which will launch the selected process with elevated privileges or I can shift-right click on the executable file and click 'Run as different user', specify the username and password which will launch the process with standard privileges using the specified user context.

How do I run as a different user AND run in an elevated context? A perfect example of this would be opening an elevated command prompt using a different user context that the currently logged in user.


I don't think such an option exists.

As a work around you could start the command line as an admin and execute the following command to run the command line with admin privileges as the other user.

runas /netonly /user:YourUser cmd.exe


Yes, psexec absolutely does this.

The following example works cleanly on Windows 8.1; run the command prompt as Administrator, then:

// -i makes the app interactive
// -h elevates the execution context 
// Omitting the password forces a secure prompt
psexec -u DOMAIN\user -i -h "C:\Program Files (x86)\Microsoft Visual Studio 14.0\Common7\IDE\devenv.exe"

You can do it through PowerShell:

Start-Process powershell -Credential domain\differentUserName -ArgumentList '-noprofile -command &{Start-Process "TheApp.exe" -verb runas}'

I notice this is a very old question, but the given answers are not ideal and it's already been necroed. All the existing answers require typing archaic commands and knowing the exact path to your executable. An ideal option would make this possible using the same process you already use for privilege escalation.

If you have a non-Home edition of Windows (Vista thru 10) you can use the Security Policy Manager to make it prompt you to give your password whenever elevation occurs. It also gives you the option to select a completely different user and enter their password... which will cause the elevated process to run as them.

Simply open the start menu and type secpol.msc and hit enter to launch it (if it's available). You're looking for Local Policies > Security Options > User Account Control: Behavior of the elevation prompt for administrators in Admin Approval Mode > Prompt for credentials. Vista has a similar option that doesn't mention "Admin Approval Mode" but it does the same thing.

I think this is a much more natural option than the other's offered here and is rather reminiscent of gksudo on *nix. But if your edition of Windows doesn't include secpol.msc you will have to do some registry hackery to enable it.


I found that if I log on as the Run As account you can set the "run this program as administrator" flag on the properties / compatibility page. Then log on the secondary account and perform the shift click run as will open it as administrator.