0

I'd like to be able to start Command Prompt as admin either as default or as an easy routine.

I know about Ctrl+Shift+Enter in the search list or adding a Registry Entry for a new Context Menu, but I was wondering if there's an easier way.

If it's not possible when you start the cmd, could it be done via a command inside of it, like for example sudo on UNIX systems?

Thanks.

Francisc
  • 1,167

7 Answers7

6

For cmd, here is a quick&dirty way: Goto windows\system32 folder, make a new copy of cmd.exe and rename it to cmd2.exe, then right click cmd2.exe, select Properties->Compatibility, check Run this program as an adminstrator. Now you can use cmd2 from run dialog to invoke an elevated command prompt.

A universal way(works for other app without an extra copy) is to get a sudo clone for windows. There're many tools which are already covered in this question.

Edit:

Also refer to this question How can I always run the command prompt as administrator?

lex
  • 1,077
3

Make a Shortcut on your desktop for the command prompt, right click on the shortcut and select properties, on the shortcut tab click advanced button, when another window opens tick the run as administrator box, click ok, ok to close both windows.

enter image description here

Moab
  • 58,769
1

Answer Status

Valid for: Windows 7, Windows Server 2008 R2

Invalid for: Windows 8, Windows 10


If you are logged in with an administrator level and your UAC setting is disabled, then any command you run from the Windows' Run panel will always be executed with administrator level.

There is a shield icon indicator in the Run panel when the above condition is true, just below the text box, with a warning note: "This task will be created with administrative privileges."

Run panel with UAC-bypass warning

Note: Disabling UAC is not a recommended behaviour. This answer is for informational purpose highlighting Windows behaviour in a certain condition.

aff
  • 370
1

I use the tool nircmd, which is an advanced command line tool. Here you can elevate programs easily via commandline on demand:

Examples:

elevate notepad.exe
elevate notepad.exe C:\Windows\System32\Drivers\etc\HOSTS
elevate "c:\program files\my software\abc.exe" 
0

Windows 7 navigate to C:\Users\YourUserName\AppData\Roaming\Microsoft\Windows\Start Menu\Programs\Accessories

Windows 8 C:\Users\user\AppData\Roaming\Microsoft\Windows\Start Menu\Programs\System Tools

Right click cmd.exe go to advanced and click run as administrator.

0

Runas command is part of windows 7.

https://technet.microsoft.com/en-us/library/cc771525.aspx

You can supplement with /savecred, but that one is not recommended - it allows running ANY application as admin without typing in password. And It does not require tinkering with UAC.

And you can use it in shortcuts.

AcePL
  • 1,919
0

You can run any program with admin privileges by making a string value entry in the Registry under HKCU\Software\Microsoft\Windows NT\CurrentVersion\AppCompatFlags\Layers with the path to the file as the name and a value of ~ RUNASADMIN.

So, in order to always run cmd.exe as admin, make a .reg file with the following content and run it:

Windows Registry Editor Version 5.00

[HKEY_CURRENT_USER\Software\Microsoft\Windows NT\CurrentVersion\AppCompatFlags\Layers]
"C:\\Windows\\System32\\cmd.exe"="~ RUNASADMIN"
Francisc
  • 1,167