How to open Command Prompt as admin from File Explorer 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

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 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.

Open Command Prompt as admin from 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 Top 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, but with the admin console.