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.

  • 1
    I think powershell the start-process command might be able to do this.
    – jiggunjer
    Commented Jan 17, 2016 at 15:02

8 Answers 8


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

  • 7
    Or you can right click the executable, then select properties>compatability and then select Privilege Level and check Run this program as an administrator. Then shift right click the executable and run as a different user. Commented Oct 18, 2013 at 21:02
  • @NewProgrammerJames This trick doesn't work with CMD directly on W2008R2 and above, but tweaking a custom app should be possible.
    – Vesper
    Commented Jul 2, 2015 at 7:52
  • This will work even if the end user isn't in the admin group?
    – jiggunjer
    Commented Jan 17, 2016 at 14:56
  • @jiggunjer No, as far as I know.
    – Yass
    Commented Jan 17, 2016 at 14:57

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"
  • 1
    From Mike: This works for Windows 10!
    – fixer1234
    Commented Dec 24, 2015 at 9:39

You can do it through PowerShell:

Start-Process powershell -Credential domain\differentUserName -ArgumentList '-noprofile -command &{Start-Process "TheApp.exe" -verb runas}'
  • 1
    Folks, this actually works. At least on Windows Server 2016. Make sure you run this command from a PowerShell window which is already running "As Administrator." Commented Sep 28, 2021 at 14:50
  • 1
    Thats the correct answer.
    – Gabriel
    Commented Nov 17, 2021 at 7:10
  • However is there no Powershell way, to do both in one go, this is so stupid, to dispatch again...
    – Gabriel
    Commented Nov 17, 2021 at 7:11
  • You can also use wrap an additional -Verb RunAsUser to trigger the 'Run as a different user' security dialog instead of having to specify the username in the command - see my supplementary answer below.
    – Minkus
    Commented Jun 13 at 13:47

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 did this and it doesn't work. And it always asks for my fingerprint instead although I don't configure my fingerprint auth.
    – iroel
    Commented May 6, 2018 at 3:02
  • @iroel That sounds distinct like there is a configuration problem with your windows' authentication subsystems. You should consider searching SU for a solution to that problem and, if you find nothing, consider posting it as a question. All my systems are set up this way and none of them ask for a thumbprint. Depending on the account I'm authenticating as they ask for either a password or a pin number. Commented May 7, 2018 at 15:48
  • I use fingerprint for authentication. It does happens. 2 solutions that are applicable: make the user having administrative privilege (but it doesn’t make sense in this case), create another user and set the fingerprint (use finger that’s not registered for certain user) and use that finger when asked for elevated privilege. I use the last solution in this case. At least it works for me.
    – iroel
    Commented Jun 5, 2018 at 16:09
  • If you're being prompted for a fingerprint then either you have set up the user you are trying to log into to require a fingerprint or something is wrong with your installation of windows. Full stop. I use this setup on three different computers and none of them ask for fingerprints. I've set this up on dozens of computers for clients. Windows will prompt for a pin# when logging into a user with a pin# configured and a password for all other users. It uses whatever authentication method you have configured for that user. Commented Jun 18, 2018 at 20:55
  • 1
    Works for me, thanks! But I wish there was an option to allow alternate credentials without losing the option to one-click if you just want to use the logged-in user credentials. Commented Sep 17, 2020 at 4:12

Here's how I perform this on Windows 10 nowadays:

  • Open C:\Windows\System32 in File Explorer.

  • Hold Shift and Right Click Taskmgr.exe, select Run As Different User.

  • In Task Manager, Click File -> Create New Task

  • Check the box to Create this task with administrative privileges.

From here, I run cmd.exe or powershell.exe if I need to use a scripting language or run a script.

Note, your current user's environment variables will not be loaded in this session, so be sure to set any variables you may need like a PATH variable.

  • Thsi worked best for me as the user I was logged in with didn't have permission to use CMD or powershell
    – Dylan
    Commented Aug 18, 2022 at 1:43

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.

  • This sounded like a great option, but there was no compatibility page in the Properties of cmd.exe.
    – Sandra
    Commented Sep 3, 2019 at 13:28
  • It's under Shortcut tab / Advanced
    – Sandra
    Commented May 19, 2020 at 14:06
  • Didn't even need to log in as the "Run As" account!
    – goofology
    Commented Mar 5, 2021 at 22:44

Based on the contribution from @Darío León - but including more secure fully qualified paths, and the Windows 'Run as a different user' dialog.

The underlying principles are as follows:

  • Run Windows PowerShell hidden, then using `Start-Process -Verb RunAsUser', start another Windows PowerShell session as a different user, then sleep for 2 minutes (the default UAC timeout - if left out, the 'Run as a different user' dialog closes immediately)
  • Within the second PowerShell session, using `Start-Process -Verb RunAs', run the final application elevated

This seems to do the job for me, even when the new Windows 11 'Windows Terminal' is taking over from Windows PowerShell.

Hope this helps others out:

Run Command Prompt as elevated different user

%SystemRoot%\System32\WindowsPowerShell\v1.0\powershell.exe -NoProfile -WindowStyle Hidden -Command Start-Process -Verb RunAsUser $PSHOME\powershell.exe '-NoProfile -Command Start-Process -Verb RunAs \\\"%ComSpec%\\\"'; Start-Sleep 120

Run Windows PowerShell as elevated different user

%SystemRoot%\System32\WindowsPowerShell\v1.0\powershell.exe -NoProfile -WindowStyle Hidden -Command Start-Process -Verb RunAsUser $PSHOME\powershell.exe '-NoProfile -Command Start-Process -Verb RunAs \\\"$PSHOME\powershell.exe\\\"'; Start-Sleep 120

Run Windows PowerShell ISE as elevated different user

%SystemRoot%\System32\WindowsPowerShell\v1.0\powershell.exe -NoProfile -WindowStyle Hidden -Command Start-Process -Verb RunAsUser $PSHOME\powershell.exe '-NoProfile -Command Start-Process -Verb RunAs \\\"$PSHOME\powershell_ise.exe\\\"'; Start-Sleep 120

Run VS Code as elevated different user

%SystemRoot%\System32\WindowsPowerShell\v1.0\powershell.exe -nop -w h -c Start-Process -Verb RunAsUser $PSHOME\powershell.exe '-nop -c Start-Process -Verb RunAs \\\"%ProgramFiles%\Microsoft VS Code\Code.exe\\\"'; Start-Sleep 120

The final command is shortened using the Powershell.exe command line shortcuts (-nop -w h -c) to keep it within the MAX_PATH limit (260 characters).


runas /user: /savecred "Full path of file" Password will be saved in credentials manager, and won't prompt again.

Leave out /savecred and it will prompt.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .