Computer >> Computer tutorials >  >> System >> Windows 11

How to Add an Open Command Window Option to Windows 11s Context Menu

The Command Prompt used to be Windows’ default command-line interpreter for opening folders and files. PowerShell has gradually eclipsed it. However, many users who are more familiar with Command Prompt’s command set still prefer to utilize that interpreter over PowerShell.

As Command Prompt isn’t the primary command-line interpreter anymore, the "open command window here" option has disappeared from the context menu in Windows 11 and 10. That option enabled users to open directories in the Command Prompt by right-clicking their folders from File Explorer. This is how you can restore that option on Windows 11’s context menu.

How to Restore the Open Command Window Option With a Registry Script

To restore the Open command window here option on the context menu, you’ll need to apply a registry tweak one way or another. Instead of manually editing the registry yourself, you can set up a registry script file to do it. These are the steps for setting up a REG script file that restores the missing Open command window option.

  1. Press the Windows search button (magnifying glass icon) on the taskbar.
  2. Type Notepad in the search tool, and select to open that app.
  3. Copy this registry script code text with the Ctrl + C keyboard shortcut:
    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]
    @=
  4. Click inside Notepad and press the Ctrl + V key combination to paste the copied script code into the text editor. How to Add an Open Command Window Option to Windows 11s Context Menu
  5. Then select File > Save as in Notepad.
  6. Select the All Files option on the Save as type drop-down menu. How to Add an Open Command Window Option to Windows 11s Context Menu
  7. Enter Open command window (Admin).reg in the File name text box.
  8. Select Desktop on the left side of the Save as window.
  9. Click Save on the window.
  10. Close the Notepad app, and double-click the Open command window.reg file on the desktop. How to Add an Open Command Window Option to Windows 11s Context Menu
  11. Select Yes on the Registry Editor prompt, and click the OK button.

Now you can select a new Open Command Prompt here option on the context menu. Right-click a folder in File Explorer and select Show more options. Select the Open Command Prompt here as administrator option to open the folder’s directory within a Command Prompt window.

How to Add an Open Command Window Option to Windows 11s Context Menu

You can remove that option from the menu anytime by deleting the registry key for it. To do so, you’ll need to open the Registry Editor first. Press the Windows + R hotkey, type regedit in the Open box, and select OK.

Next, go to the Computer\HKEY_CLASSES_ROOT\Directory\shell key location in the Registry Editor. Right-click the OpenElevatedCmd registry key and select Delete. Click Yes when prompted to confirm.

How to Add an Open Command Window Option to Windows 11s Context Menu

Read also: What Is the Windows Registry and How Do I Edit It?

How to Restore the Open Command Window Option With Winaero Tweaker

The freeware Winaero Tweaker desktop app provides an alternative way to restore an Open command window context menu option. That software includes a Command Prompt as Administrator option you can select to add an Open command window shortcut for folders to the right-click menu. This is how to install Winaero Tweaker and select that option.

  1. Open the homepage for Winaero Tweaker.
  2. Click the Download Winaero Tweaker link there.
  3. Press the Windows and E keys simultaneously, and open the folder in which you saved Winaero Tweaker’s ZIP file.
  4. Double-click the Winaero Tweaker ZIP archive, and select Explorer’s Extract all option. How to Add an Open Command Window Option to Windows 11s Context Menu
  5. Select Show extracted files when complete on the Extract Compressed (Zipped) Folders window.
  6. Click Extract to bring up an extracted folder for Winaero Tweaker. How to Add an Open Command Window Option to Windows 11s Context Menu
  7. Double-click WinaeroTweaker-1.33.0.0-setup to open the installer, and click the Next button.
  8. Select the Normal mode, I accept the agreement, and Create a desktop icon options within Winaero Tweaker’s setup window. Then click the Install button. How to Add an Open Command Window Option to Windows 11s Context Menu
  9. Double-click Winaero Tweaker’s desktop shortcut.
  10. Expand the Context Menu category in Winaero Tweaker.
  11. Click the Command Prompt as Administrator option.
  12. Then select the Add elevated Command Prompt to the context menu checkbox. How to Add an Open Command Window Option to Windows 11s Context Menu
  13. Erase the text in the Context menu entry title box. Then input Open command window here in that text box.
  14. Press the Apply Changes button, and close Winaero Tweaker.

Check out the new context menu option by right-clicking a folder and selecting Show more options. Or you can select a folder and press the Shift + F10 hotkey. Selecting Open command window here on the classic context menu will open a folder’s directory in an elevated Command Prompt like the one applied with the registry script.

How to Configure the Open in Windows Terminal Option to Open With Command Prompt

Windows 11’s context menu includes an Open in Windows Terminal option that opens a folder directory within the Terminal’s default command-line interpreter. PowerShell is the default Windows Terminal interpreter, but you can change that to Command Prompt. Then a folder’s directory will open in a Command Prompt tab whenever you select Open in Windows Terminal.

  1. Right-click Start on the taskbar to select and open Windows Terminal.
  2. Click the Open a new tab (arrow) button to select Settings. How to Add an Open Command Window Option to Windows 11s Context Menu
  3. Select Command Prompt on the Default profile drop-down menu.
  4. Press the Save button at the bottom right of the Settings tab. How to Add an Open Command Window Option to Windows 11s Context Menu
  5. Click the Close button at the top right of Windows Terminal.

Try selecting the Open in Windows Terminal option by right-clicking a folder. The Windows Terminal will now open with a Command Prompt tab when you select that option. If you prefer the Command Prompt to open with a separate administrator window, however, you’ll need to add a new option to the context menu as outlined for the previous two methods.

How to Add an Open Command Window Option to Windows 11s Context Menu

Read also: How to Open the Windows Terminal in Windows 11

The Open Command Window Here Option Is a Convenient Command Prompt Shortcut

The Open command window here context menu option is a handy shortcut for all Command Prompt users. Having that option on the right-click menu will save you needing to manually open folders in the Prompt with the change directory (CD) command. So, it’s worth restoring that option in Windows 11 if you often utilize the Command Prompt.