How to add Command Prompt (admin) to File Explorer context menu on Windows 11

Here are the steps to open the File Explorer path on Command Prompt as an administrator on Windows 11.

File Explorer Command Prompt admin context menu
File Explorer Command Prompt admin context menu
  • To add the option to open Command Prompt (admin) from File Explorer, create the “runas” key, set the default string as “Command Prompt (Admin),” create the “NoWorkingDirectory” and “HasLUAShield” strings, create and set the “Position” string to “Top,” create and set the “Icon” string to “C:\\Windows\\System32\\cmd.exe.” And create the “command” key and set the default string to “cmd.exe /s /k pushd \”%V\”” then restart the computer.

On Windows 11, when you right-click inside a folder, you will find the option to open that File Explorer path in Command Prompt, but you won’t find an entry to open the console as an administrator.

However, if you must open a particular folder location in File Explorer with Command Prompt as an administrator to run an application, it’s possible to add an entry to the classic context menu through the Registry.

In this guide, you will learn the steps to add a new entry in the File Explorer (classic) context menu to open a specific path in Command Prompt as an administrator on Windows 11 (or Windows 10).

Warning: It’s important to note that modifying the Windows Registry can cause serious problems if not used properly. It’s assumed you know what you’re doing and that you have created a full backup of your system before proceeding.

Add Command Prompt (admin) to context menu on File Explorer

To open Command Prompt as an administrator from the File Explorer context menu on Windows 11, use these steps:

  1. Open Start on Windows 11.

  2. Search for regedit and click the top result to open the app.

  3. Navigate to the following path:

    HKEY_CLASSES_ROOT\Directory\Background\shell
  4. Right-click the “shell” key (folder), select New, and choose the Key option.

    Shell create runas key

  5. Name the key “runas” and press Enter.

  6. Select the runas key.

  7. Double-click the “Default” string and set its value to Command Prompt (Admin).

    Change default string value

  8. Click the OK button.

  9. Right-click the “runas” key (folder), select New, and choose the String Value option.

    Create NoWorkingDirectory string

  10. Name the key NoWorkingDirectory and press Enter.

  11. Right-click the “runas” key (folder), select New, and choose the String Value option.

  12. Name the key HasLUAShield and press Enter.

  13. Right-click the “runas” key (folder), select New, and choose the String Value option.

  14. Name the key Position and press Enter.

  15. Double-click the newly created key and change its value to Top.

    runas top

  16. Click the OK button.

  17. Right-click the “runas” key (folder), select New, and choose the String Value option.

  18. Name the key Icon and press Enter.

  19. Double-click the newly created key and change its value to C:\\Windows\\System32\\cmd.exe.

    Path to Command Prompt icon

  20. Click the OK button.

  21. Right-click the “runas” key (folder), select New, and choose the Key option.

  22. Name the key command and press Enter.

    Create NoWorkingDirectory string

  23. Double-click the Default string and set its value to cmd.exe /s /k pushd \"%V\".

    Context menu Command Prompt admin entry

  24. Click the OK button.

  25. Restart the computer.

Once you complete the steps, use the “Shift + F10” keyboard shortcut or right-click inside of a folder and choose the “Show more options” item to open the classic context menu to find the option to open the path in Command Prompt (admin), but with the admin console on Windows 11.

About the author

Mauro Huculak is a Windows How-To Expert who started Pureinfotech in 2010 as an independent online publication. He has also been a Windows Central contributor for nearly a decade. Mauro has over 15 years of experience writing comprehensive guides and creating professional videos about Windows and software, including Android and Linux. Before becoming a technology writer, he was an IT administrator for seven years. In total, Mauro has over 21 years of combined experience in technology. Throughout his career, he achieved different professional certifications from Microsoft (MSCA), Cisco (CCNP), VMware (VCP), and CompTIA (A+ and Network+), and he has been recognized as a Microsoft MVP for many years. You can follow him on X (Twitter), YouTube, LinkedIn and About.me. Email him at [email protected].