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.

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?

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

  • It's an idea, but the problem is I can't run that from anywhere. I have to go to the desktop, locate and open the icon, then cd my way to where I need it to be which is too slow. – Francisc Jul 6 '15 at 20:28
  • You might add that info to your question, would make it more clear in what Exactly what you need. – Moab Jul 6 '15 at 21:47
  • You don't think the question title clearly states what I need? – Francisc Jul 7 '15 at 20:24
  • Not really imho – Moab Jul 7 '15 at 22:02
  • OK, well I want to start cmd.exe from the run panel (runas panel) with admin privileges. – Francisc Jul 8 '15 at 21:18
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" 
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.

  • though disabling UAC is not recommended – barlop Jul 5 '15 at 20:54
  • it's not very useful to say you prefer "the other" answer when there are many other answers so it's not clear what you are referring to, and if you don't say why you prefer that other answer over every other answer(if you've even tried all the others which I doubt you have). – barlop Jul 6 '15 at 2:56
  • @barlop Good point, thank you for your input. Comment moved to answer with additional information. "Other answer" will not be covered in this answer. – aff Jul 6 '15 at 13:16
  • Well, saying theirs is better is rather subjective, and I wouldn't necessarily agree that theirs is better. Both can be unpleasing. A UAC prompt(while it has its importance), can be a nuisance in this case, and they haven't been clear whether their answers still give a UAC prompt. Yours does have an advantage over theirs in not involving a UAC prompt. Some might keep a cmd prompt open because of the nuisance and do the UAC prompt once. It might be a good idea to check Peter Will's answer superuser.com/questions/453409/… – barlop Jul 6 '15 at 13:34
  • Also it's not clear why you favour Chris or Moab's answers over all other answers that don't involve disabling the UAC prompt. You aren't really adding anything useful by stating that people refer to chris or moab's answer.. The reason you appear to now give (the fact that their ones don't disable the UAC prompt), could apply to other answers too or future answers, so it doesn't justify your limited preferences. People can see from the votes that the two most "popular" answers(on this thread) are chris and moabs. And anyhow.. i'd look towards Peter Will's answer in that other thread – barlop Jul 6 '15 at 13:40
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.

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"

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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