- 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).
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:
-
Open Start on Windows 11.
-
Search for regedit and click the top result to open the app.
-
Navigate to the following path:
HKEY_CLASSES_ROOT\Directory\Background\shell
-
Right-click the “shell” key (folder), select New, and choose the Key option.
-
Name the key “runas” and press Enter.
-
Select the runas key.
-
Double-click the “Default” string and set its value to Command Prompt (Admin).
-
Click the OK button.
-
Right-click the “runas” key (folder), select New, and choose the String Value option.
-
Name the key NoWorkingDirectory and press Enter.
-
Right-click the “runas” key (folder), select New, and choose the String Value option.
-
Name the key HasLUAShield and press Enter.
-
Right-click the “runas” key (folder), select New, and choose the String Value option.
-
Name the key Position and press Enter.
-
Double-click the newly created key and change its value to Top.
-
Click the OK button.
-
Right-click the “runas” key (folder), select New, and choose the String Value option.
-
Name the key Icon and press Enter.
-
Double-click the newly created key and change its value to
C:\\Windows\\System32\\cmd.exe
. -
Click the OK button.
-
Right-click the “runas” key (folder), select New, and choose the Key option.
-
Name the key command and press Enter.
-
Double-click the Default string and set its value to
cmd.exe /s /k pushd \"%V\"
. -
Click the OK button.
-
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.