14.08.2019»»среда

Windows 10 Run As Different User

14.08.2019
    51 - Comments
Windows 10 Run As Different User 10,0/10 8768 reviews
  1. Windows 10 Run As Different User Does Nothing
  2. How To Run As Administrator
  3. Windows 10 Run As Different User Registry

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?

Oct 05, 2017  The version we are using is Windows 10 v1703. The option works on Windows 10 v1607/ v1511 I enabled a registry hack to 'HKEYCURRENTUSERSoftwarePoliciesMicrosoftWindowsExplorerShowRunasDifferentuserinStart' and set in a value of 1(HEX) to enable run as different user in start and am able to do it now. If you want an app to run as a different user from Start menu on your Windows 10 PC a simple tweak either in Group Policy Editor or Registry Editor is sufficient. Earlier and also in Windows 10 when you press Shift Key and right click along with on any application you find Run as different user choice in the context menu.

UPDATE: I am using Windows Server 2012

UPDATE: I opened cmd for another account by running

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).

Mark
MarkMark
4631 gold badge6 silver badges14 bronze badges

closed as off-topic by Makyen, ekad, Ken White, Mike M., MachavityApr 12 at 3:19

This question appears to be off-topic. The users who voted to close gave this specific reason:

  • 'Questions about general computing hardware and software are off-topic for Stack Overflow unless they directly involve tools used primarily for programming. You may be able to get help on Super User.' – Makyen, ekad, Ken White, Mike M., Machavity
If this question can be reworded to fit the rules in the help center, please edit the question.

9 Answers

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

According to that the command looks like this for admin:

Community
HermsHerms
23.5k10 gold badges70 silver badges98 bronze badges

All of these answers unfortunately miss the point.

There are 2 security context nuances here, and we need them to overlap.- 'Run as administrator' - changing your execution level on your local machine- 'Run as different user' - selects what user credentials you run the process under.

When UAC is enabled on a workstation, there are processes which refuse to run unless elevated - simply being a member of the local 'Administrators' group isn't enough. If your requirement also dictates that you use alternate credentials to those you are signed in with, we need a method to invoke the process both as the alternate credentials AND elevated.

What I found can be used, though a bit of a hassle, is:

  • run a CMD prompt as administrator
  • use the Sysinternals psexec utility as follows:

    psexec localworkstation -h -i -u domainotheruser exetorun.exe

    Celebrate 20 years of Sonic with Sonic Generations! Delivering the definitive gaming experience for Sonic fans old and new, Sonic Generations sees Sonic the Hedgehog playable as both the much loved classic 1991 character, and the modern day video game hero he has become in. Generations Nov 01, 2011  Sonic Generations (Region Free) PC Download for PC/Windows. Game description, information and PC download page. Feb 20, 2016  Sonic Generations Windows, X360, PS3 game. For this new release, I've provided an on-site download for Super Sonic Generations (along with 3 alternative off-site download links just in-case) because a lot of users didn't notice that I'd previously only provided a download off-site. Nov 01, 2011  Sonic Generations PSN (USA) PS3 PKG Download for the Sony PlayStation 3/PS3/RPCS3. Game description, information and ISO download page.

The first elevation is needed to be able to push the psexec service. The -h runs the new 'remote' (local) process elevated, and -i lets it interact with the desktop.

Perhaps there are easier ways than this?

KevinKevin

Start -> shift + command Prompt right click will helps to use as another user or as Admin

Sun_SparxzSun_Sparxz
6502 gold badges11 silver badges24 bronze badges

I've found a way to do this with a single line:

There are a few tricks going on here.

1: We are telling CMD just to run Powershell as DOMAINUSER2

Windows 10 Run As Different User Does Nothing

2: We are passing the 'Start-Process' command to Powershell, using the verb 'runAs' to elevate DOMAINUSER2 to Administrator/Elevated privilege mode.

As a general note, the escape characters in the 'FilePath' argument must be present (in other words, the ' & character combinations), and the single quotation (') must surround the EXE path - this way, CMD interprets the FilePath as a single string, then Powershell uses the single quotation to interpret the FilePath as a single argument.

Using the 'RunAs' verb to elevate within Powershell: http://ss64.com/ps/syntax-elevate.html

Coruscate5Coruscate5

Runas doesn't magically run commands as an administrator, it runs them as whatever account you provide credentials for. If it's not an administrator account, runas doesn't care.

WugWug
10.2k4 gold badges23 silver badges50 bronze badges

You can use psexec.exe from Microsoft Sysinternals Suite https://docs.microsoft.com/en-us/sysinternals/downloads/sysinternals-suite

Example:

Ralf Stubner
17k2 gold badges20 silver badges43 bronze badges
Paweł M.Paweł M.

In my case I was already logged in as a local administrator and I needed to run CMD as a domain admin so what worked for me was running the below from a powershell window:

runas /noprofile /user:DOMAINUSER 'cmd'

Ajay RawAjay Raw

Open notepad and paste this code:

Then, save the file as sudo.cmd. Copy this file and paste it at C:WindowsSystem32 or add the path where sudo.cmd is to your PATH Environment Variable.

When you open command prompt, you can now run something like sudo start ..

If you want the terminal window to stay open when you run the command, change the code in notepad to this:

Windows 10 run program as different user

Explanation:

powershell -Command runs a powershell command.

Start-Process is a powershell command that starts a process, in this case, command prompt.

-Verb RunAs runs the command as admin.

-Argument-List runs the command with arguments.

Our arguments are '/c %*'. %* means all arguments, so if you did sudo foo bar, it would run in command prompt foo bar because the parameters are foo and bar, and %* returns foo bar.

The /c is a cmd parameter for closing the window after the command is finished, and the /k is a cmd parameter for keeping the window open.

CME1 CrewmemberCME1 Crewmember

The easiest is to create a batch file (.bat) and run that as administrator.

Right click and 'Run as administrator'

nash.ionash.io

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

The “Run as different user” context menu option allows you to run bat, cmd, exe, msc or msi files as another user. This context menu option is not shown by default for Pinned items in Windows 10 Start screen, but can be added using a registry setting or Group Policy.

“Run as different user” – Show on Start in Windows 10

Start Regedit.exe and go to the following branch:

(or)

Create a DWORD value named ShowRunAsDifferentUserInStart and set its value data to 1. Exit the Registry Editor.

REG file

This setting corresponds to the following Group Policy setting:

Enable run as different user

You can configure this as per-user, or per-machine setting as required.

One small request: If you liked this post, please share this?

One 'tiny' share from you would seriously help a lot with the growth of this blog.Some great suggestions:User

How To Run As Administrator

  • Pin it!
  • Share it to your favorite blog + Facebook, Reddit
  • Tweet it!

Windows 10 Run As Different User Registry

So thank you so much for your support, my reader. It won't take more than 10 seconds of your time. The share buttons are right here. :)

You'd like to read these articles:

About the author

Ramesh Srinivasan founded Winhelponline.com back in 2005. He is passionate about Microsoft technologies and has a vast experience in Windows — delivering support for Microsoft's consumer products. He has been a Microsoft MVP (2003-2012) who contributes to various Windows support forums.