Run as different user and elevate

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}'

Tags:

Windows

Uac