Advertisement

Add Command Prompt As Administrator Context Menu in Windows 10

The command prompt in Windows 10 is the shell environment where you can run text-based console tools and utilities by typing commands. Its UI is very simple and does not have any buttons or graphical commands. In this article, we'll see how to add "Open Command prompt here as Administrator" to the context menu in Windows 10.

Open Command Prompt Here As Administrator File Explorer

Note: Microsoft has removed the command prompt entries from both the Win + X menu and the context menu in Windows 10 Creators Update. See Add Command Prompt back to Win+X Menu in Windows 10 Creators Update and Add Command Prompt to Context Menu in Windows 10 Creators Update to restore this functionality.

Advertisеment

You can add the "Open Command prompt here as Administrator" command to the context menu of File Explorer in Windows 10. This will open a new elevated command prompt instance in the current directory that you right clicked on or are browsing with File Explorer.

To add "Open Command prompt here as Administrator" to the context menu in Windows 10, do the following.

Apply the Registry tweak listed below. Paste its contents inside Notepad and save as a *.reg file.

Windows Registry Editor Version 5.00

[HKEY_CLASSES_ROOT\Directory\shell\OpenElevatedCmd]
@="Open command prompt here as administrator"
"Icon"="cmd.exe"

[HKEY_CLASSES_ROOT\Directory\shell\OpenElevatedCmd\command]
@="PowerShell -windowstyle hidden -Command \"Start-Process cmd.exe -ArgumentList '/s,/k,pushd,%V' -Verb RunAs\""

[HKEY_CLASSES_ROOT\Directory\Background\shell\OpenElevatedCmd]
@="Open command prompt here as administrator"
"Icon"="cmd.exe"

[HKEY_CLASSES_ROOT\Directory\Background\shell\OpenElevatedCmd\command]
@="PowerShell -windowstyle hidden -Command \"Start-Process cmd.exe -ArgumentList '/s,/k,pushd,%V' -Verb RunAs\""

[HKEY_CLASSES_ROOT\Drive\shell\OpenElevatedCmd]
@="Open command prompt here as administrator"
"Icon"="cmd.exe"

[HKEY_CLASSES_ROOT\Drive\shell\OpenElevatedCmd\command]
@="PowerShell -windowstyle hidden -Command \"Start-Process cmd.exe -ArgumentList '/s,/k,pushd,%V' -Verb RunAs\""

[HKEY_CLASSES_ROOT\LibraryFolder\background\shell\OpenElevatedCmd]
@="Open command prompt here as administrator"
"Icon"="cmd.exe"

[HKEY_CLASSES_ROOT\LibraryFolder\background\shell\OpenElevatedCmd\command]
@=

Paste In Notepad

In Notepad, press Ctrl + S or execute the File - Save item from the File menu. This will open the Save dialog. There, type or copy-paste the name "cmd.reg" including quotes.

Save Tweak As Reg File

Double quotes are important to ensure that the file will get the "*.reg" extension and not *.reg.txt. You can save the file to any desired location, for example, you can put it in your Desktop folder.

Double click the file you created, confirm the import operation and you are done.

Import Cmd Tweak

Now right-click any folder.

Open Command Prompt Here As AdministratorOpen Command Prompt Here As Administrator File ExplorerOpen Command Prompt Here As Administrator Windows 10

To save your time, I made ready-to-use Registry files. You can download them here:

Download Registry Files

The undo tweak is included.

Alternatively, use you can use Winaero Tweaker.

Tweaker Cmd As Admin Context Menu

You can download Winaero Tweaker here:

Download Winaero Tweaker

Support us

Winaero greatly relies on your support. You can help the site keep bringing you interesting and useful content and software by using these options:

If you like this article, please share it using the buttons below. It won't take a lot from you, but it will help us grow. Thanks for your support!

Advertisеment

Author: Sergey Tkachenko

Sergey Tkachenko is a software developer who started Winaero back in 2011. On this blog, Sergey is writing about everything connected to Microsoft, Windows and popular software. Follow him on Telegram, Twitter, and YouTube.

17 thoughts on “Add Command Prompt As Administrator Context Menu in Windows 10”

  1. When I use Winaero to “Add Command Prompt as Administrator to Context Menu”, I get the following error when I launch the cmd window: “The system cannot find the drive specified”.

    I think this issue is related to the one reported by Nazar on https://winaero.com/blog/add-command-prompt-to-context-menu-in-windows-10-creators-update/.
    You told him what to change in the .txt file to fix the issue. I can’t seem to change what Winaero uses though.
    Can you apply the changes you told him to WInaero and release an update with those changes?

    1. Upon further investigation, It seems I get that error only when I am trying to open a cmd file with admin privileges on a folder in a networked drive, such as my H drive.

      Do you know how to fix this?

  2. I used WinAero to add the Open Command Windows in the contect menu, but it doesn’t work anymore, It worked on previous windows 10, and using Previous versions of Winaero.
    Not working on 1909 Windows 10, using the latest Winaero as of today.

  3. Thanks a lot! Spend 30 min googling to find this method, it works with UAC instead just deleting HideBasedOnVelocityId from registry

  4. Hi my dear friend,

    Could you tell me I have to change the registry below so that it is shown only when the “S” key like in yours is pressed?

    **** ****
    Windows Registry Editor Version 5.00

    “[HKEY_CLASSES_ROOT\AllFilesystemObjects\shellex\ContextMenuHandlers\SendTo]
    @=”{7BA4C740-[HKEY_LOCAL_MACHINE\SOFTWARE\Classes\Directory\background\shell\Abrir Controle Contas de Usuário]

    [HKEY_LOCAL_MACHINE\SOFTWARE\Classes\Directory\background\shell\Abrir Controle Contas de Usuário Avançadas\command]
    @=”Control userpasswords2″

    [HKEY_LOCAL_MACHINE\SOFTWARE\Classes\Directory\background\shell\Abrir Registro do Windows]

    [HKEY_LOCAL_MACHINE\SOFTWARE\Classes\Directory\background\shell\Abrir Registro do Windows\command]
    @=”Regedit”

    [HKEY_LOCAL_MACHINE\SOFTWARE\Classes\Directory\background\shell\Abrir Conta do Usuário Atual]

    [HKEY_LOCAL_MACHINE\SOFTWARE\Classes\Directory\background\shell\Abrir Conta do Usuário Atual\command]
    @=”Control userpasswords”

    [HKEY_LOCAL_MACHINE\SOFTWARE\Classes\Directory\background\shell\Adicionar ou Remover Programas e recursos]

    [HKEY_LOCAL_MACHINE\SOFTWARE\Classes\Directory\background\shell\Adicionar ou Remover Programas e recursos\command]
    @=”control appwiz.cpl”

    **** ****

    Thanks in advanced.

    Best Regards
    Jeepwillys58

      1. Hi my dear friend and mentor…

        I added as you indicated, but it still shows the commands even without using the “s” key together with the click and what I wanted is that these commands only appear when using the combination of “S” + the right mouse click. ..

        Look at the picture: https://i.ibb.co/9Z5r79v/image.png

        Thanks in advanced
        JeepWillys58

  5. Hi again my friend,

    I got confused and asked you wrong, sorry for my little experience, I mean I want to show hidden menu items only when using the right click of the maouse combined with the “Shift” key, as shown in Winaero Tweaker in the option ” Show only if Shift + Richt click (extend) menu.

    Forgive me for the mess…

    Regards

    JeepWillys58

Leave a Reply

Your email address will not be published.

css.php
Using Telegram? Subscribe to the blog channel!
Hello. Add your message here.