Open CMD as admin with Windows+R shortcut

31

12

My preference for running CMD is to use Windows+R » type cmd » Enter.

But this doesn't open it with admin rights. Is there a way to type your way through to command prompt with admin rights?

Mohamed Khamis

Posted 2015-09-04T10:21:46.840

Reputation: 671

2Which version of Windows? You can start an admin command prompt from Win+x "Power User Menu" in recent versions. – bertieb – 2015-09-04T10:33:40.847

1You could type runas /user:Administrator cmd – RJFalconer – 2015-09-04T10:38:52.720

@RJFalconer This is valid. Please post it as an answer – nixda – 2015-09-04T10:42:16.197

Also check out my wsudo, a sudo-like tool for Windows available as a Chocolatey package.

– noseratio – 2019-02-19T05:19:14.917

Answers

42

The easiest and quickest solution that follows your method, is by starting the command prompt as follows:

Press win to open the start menu. Type in cmd to search for Command Prompt.

Press ctrl+shift+enter to launch Command Prompt as administrator.

This works from Windows 7 and up.

win+r does not natively support this though, but an alternative (and less quick) way, is to type in runas /user:Administrator cmd and then type the password for the administrator account.

EDIT: It seems that the latest version of Windows 10 does offer support for ctrl+shift+enter at the Win+R dialog, so you can now use it there too.

LPChip

Posted 2015-09-04T10:21:46.840

Reputation: 42 190

1The first option is pretty quick! the second one is eventually even faster if Win + R keeps the command ;) – Mohamed Khamis – 2015-09-04T12:55:51.353

Note that ctrl+shift+enter works on any shortcut found in Start menu. If it is a real program it will fail to elevate to Admin – gavenkoa – 2017-09-21T08:50:25.677

1Ctrl+Shift+Enter works even in the Win+R prompt – phuclv – 2018-09-08T09:25:56.350

@phuclv Microsoft must have changed this behavior then. It was not possible to do this earlier. Thanks for letting me know. I've updated the answer. – LPChip – 2018-09-08T10:55:28.027

actually that shortcut has existed since Vista. However in my experience it doesn't work reliably on all PCs although I don't know the real reason

– phuclv – 2018-09-08T11:01:17.977

Press Windows Key + X then press A to open a CMD.exe with admin rights. – Rahul – 2019-09-18T16:22:33.280

@Rahul newer versions of Windows 10 will replace CMD with Powershell. when that happens, your suggestion will open Powershell as CMD. Although it would still work, not everyone is comfortable with that. – LPChip – 2019-09-18T19:06:27.703

23

Another fast way is to use Windows+X then hit A.

However I marked the other answer as the correct one because the question originally asked for a way to do that through Windows+R

Mohamed Khamis

Posted 2015-09-04T10:21:46.840

Reputation: 671

2Nice answer. It does however only apply to Windows 8 and higher., which is something you did not specify in your question. Win+R is available in all OS's including Windows XP even. Because Windows XP is long dead, I carefully assumed you'd be at least on windows 7 by now. – LPChip – 2015-09-04T14:11:40.380

1Just a heads-up, this does not work on the latest Windows 10 anymore, given that Microsoft has replaced Command Prompt with Powershell. – LPChip – 2018-07-05T15:01:16.393

3Voting this as you can still use this in Windows 10, by going to Settings>Taskbar>[Replace Command Prompt with Windows Powershell ..] -- turn this off. – Sid – 2018-07-26T05:26:11.993

Perhaps this is the coolest thing of day. I wish somehow I can bypass run as admin prompt by windows. I have to click on yes every time – Maulik Modi – 2019-11-01T04:47:19.037

2

In Windows 10, you can also type cmd in Run window, press Shift + Ctrl + Enter, instead of just pressing just enter. It will ask for permission & cmd will be in Administrator mode.

zackygaurav

Posted 2015-09-04T10:21:46.840

Reputation: 121

@phuclv Accepted answer is telling to search command prompt in Start menu. My answer is useful in the case where start menu doesn't open. – zackygaurav – 2018-09-08T09:22:31.197

no. In any Windows, not only Windows 10, pressing Win+R, type command > Ctrl+Shift+Enter works. And in Windows 10 it's better to use Win+X > A – phuclv – 2018-09-08T09:24:48.073

@phuclv Dude, instead of telling in comments, add your own answer. – zackygaurav – 2018-09-08T09:26:01.033

no. this should be an answer to the other answer – phuclv – 2018-09-08T09:26:26.617

2

a simple answer:

  1. create a shortcut (LNK) to cmd.exe
  2. right-click the shortcut > properties > advanced > [v] run as administratir
  3. move the shortcut to a directory on the PATH

now: Win+R > admin > simply hit ok or enter.

nice to have

  1. UAC auto-click. it's possible, but WAY out of this scope (and a security break), so I'll press manually Alt+y.
  2. system-wide keyboard shortcut that links to this shortcut (or alternative command) directly. I'm using Win+Alt+C

alternative (external) commands

elevate.exe cmd
nircmdc.exe elevatecmd
powershell.exe -command "Start-Process cmd -ArgumentList '/c %CD% && %1 %2 %3 %4 %5' -Verb runas"

(Tested on windows 7)

Berry Tsakala

Posted 2015-09-04T10:21:46.840

Reputation: 1 049

1

To run cmd as administrator through Win+R without additional password typing (but UAC warning is still in-place though) just use the following trick:

powershell "Start-Process cmd -Verb RunAs"

If you want to get an access to cmd by clicking a shortcut:

  1. Create a shortcut for cmd (C:\Windows\System32\cmd.exe)
  2. Right-click the shortcut > Properties
  3. Find "Target" field on "Shortcut" tab
  4. Replace the target value with C:\Windows\System32\cmd.exe /C powershell "Start-Process cmd -Verb RunAs"

Hope this helps.

ROB BEN

Posted 2015-09-04T10:21:46.840

Reputation: 11