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.

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.

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]
@=

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.

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.

Now right-click any folder.

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.

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!

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

  1. Kade

    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?

    Reply
    1. Kade

      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?

      Reply
  2. Charlie

    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.

    Reply
  3. haos

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

    Reply
  4. JeepWillys58

    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

    Reply
    1. Sergey Tkachenko Post author

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

      Reply
      1. JeepWillys58

        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

        Reply
  5. JeepWillys58

    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

    Reply

Leave a Reply

Your email address will not be published.