Site icon Winhelponline

Add “Open command window here” to Context Menu in Windows 10

In the recent versions of Windows 10 (Creators Update and higher), the “Open Command Prompt here” context menu entry has been removed and is replaced by “Open PowerShell window here”.

Microsoft, in an effort to bring the best command line experiences to the forefront for all power users, has made PowerShell the de facto command shell.

This article tells you how to add “Open command window here” to right-click menu in Windows 10. Optionally, you can also remove the Open PowerShell window here from the context menu.

You may also be knowing that since the preview build 14971, “Command Prompt” and “Command Prompt (Admin)” entries in the Win+X menu (the menu which appears when you right-click Start) were replaced with PowerShell links.

Quoting Microsoft:

It (PowerShell) replaces Command Prompt (aka, “cmd.exe”) in the WIN + X menu, in File Explorer’s File menu, and in the context menu that appears when you shift-right-click the whitespace in File Explorer. Typing “cmd” (or “powershell”) in File Explorer’s address bar will remain a quick way to launch the command shell at that location.

For those who prefer to use Command Prompt, you can opt-out of the WIN + X change by opening Settings → Personalization → Taskbar, and turning “Replace Command Prompt with Windows PowerShell in the menu when I right-click the Start button or press Windows key+X” to “Off”.

Although you can run the old commands in the PowerShell window, you need to use the “.exe” suffix when running certain commands. For instance, running the “SC” command under the PowerShell window gives different results than what you get when running the same command from a regular Command Prompt shell.

SC” is understood as the alias for “Set-Content” PowerShell cmdlet. So to manage services using the SC (SC.EXE) command in the PowerShell window, you’ll need to type the file extension — .EXE. Whereas the regular Command Prompt (CMD.exe) shell knows SC is nothing but SC.EXE, assuming no file of the same name and with a .COM extension exists in the path.

Add Command Prompt to the Context menu

If you’re fond of the old Command Prompt (cmd.exe), you can add the traditional “Open Command window here” option back in the context menu for file system folders and drives, using a Registry edit.

Method 1

This method creates a new menu item named “Open command window here” by adding the necessary context menu registry entries.

  1. Open Notepad.
  2. Copy the following lines and paste them in Notepad:
    Windows Registry Editor Version 5.00
    
    [HKEY_CLASSES_ROOT\Directory\shell\cmdprompt]
    @="@shell32.dll,-8506"
    "NoWorkingDirectory"=""
    
    [HKEY_CLASSES_ROOT\Directory\shell\cmdprompt\command]
    @="cmd.exe /s /k pushd \"%V\""
    
    [HKEY_CLASSES_ROOT\Directory\Background\shell\cmdprompt]
    @="@shell32.dll,-8506"
    "NoWorkingDirectory"=""
    
    [HKEY_CLASSES_ROOT\Directory\Background\shell\cmdprompt\command]
    @="cmd.exe /s /k pushd \"%V\""
    
    [HKEY_CLASSES_ROOT\Drive\shell\cmdprompt]
    @="@shell32.dll,-8506"
    "NoWorkingDirectory"=""
    
    [HKEY_CLASSES_ROOT\Drive\shell\cmdprompt\command]
    @="cmd.exe /s /k pushd \"%V\""
    
  3. Save the file as “cmdhere.reg
  4. Double-click the file to apply the settings to the registry.

Alternately, you can download the following registry file:

This adds the “Open command window here” option to the right-click menu for folders and drives, which, when clicked, opens a Command Prompt window at the current drive or directory path.

To have the Command Prompt context menu icon, apply the cmd-here-windows-10-with-icon.reg file included in the zip file.

Additional Tip: Add “Open command window here” as an extended menu

If you want to show the “Open command window here” as an extended or hidden menu (to reduce clutter), use this registry file instead:

Windows Registry Editor Version 5.00

[HKEY_CLASSES_ROOT\Directory\shell\cmdprompt]
@="@shell32.dll,-8506"
"NoWorkingDirectory"=""
"Extended"=""

[HKEY_CLASSES_ROOT\Directory\shell\cmdprompt\command]
@="cmd.exe /s /k pushd \"%V\""

[HKEY_CLASSES_ROOT\Directory\Background\shell\cmdprompt]
@="@shell32.dll,-8506"
"NoWorkingDirectory"=""

[HKEY_CLASSES_ROOT\Directory\Background\shell\cmdprompt\command]
@="cmd.exe /s /k pushd \"%V\""

[HKEY_CLASSES_ROOT\Drive\shell\cmdprompt]
@="@shell32.dll,-8506"
"NoWorkingDirectory"=""
"Extended"=""

[HKEY_CLASSES_ROOT\Drive\shell\cmdprompt\command]
@="cmd.exe /s /k pushd \"%V\""

An “extended” menu appears only when you press and hold the Shift key when right-clicking on a folder or drive.


Method 2

The “Open command window here” context menu registry entry still exists by default in Windows 10. But it’s been made inactive with a registry value named HideBasedOnVelocityId.

In this method, we change the HideBasedOnVelocityId registry value to 0 using the HKEY_CURRENT_USER override. This will enable the built-in and dormant “Open command window here” in the right-click menu.

  1. Open Notepad.
  2. Copy the following lines and paste them in Notepad:
    Windows Registry Editor Version 5.00
    
    [HKEY_CURRENT_USER\SOFTWARE\Classes\Directory\shell\cmd]
    "HideBasedOnVelocityId"=dword:00000000
    "Icon"=hex(2):25,00,73,00,79,00,73,00,74,00,65,00,6d,00,72,00,6f,00,6f,00,74,\
      00,25,00,5c,00,73,00,79,00,73,00,74,00,65,00,6d,00,33,00,32,00,5c,00,63,00,\
      6d,00,64,00,2e,00,65,00,78,00,65,00,2c,00,30,00,00,00
    
    [HKEY_CURRENT_USER\SOFTWARE\Classes\Drive\shell\cmd]
    "HideBasedOnVelocityId"=dword:00000000
    "Icon"=hex(2):25,00,73,00,79,00,73,00,74,00,65,00,6d,00,72,00,6f,00,6f,00,74,\
      00,25,00,5c,00,73,00,79,00,73,00,74,00,65,00,6d,00,33,00,32,00,5c,00,63,00,\
      6d,00,64,00,2e,00,65,00,78,00,65,00,2c,00,30,00,00,00
    
  3. Save the file as “cmdhere2.reg
  4. Double-click the file to apply the settings to the registry.

That’s it. This enables the “Open command window here” context menu item (with icon) for directories and drives.

This method works only for the current user account — i.e., per-user account basis.

(For the Windows 11 version of this article, check out the page How to Add “Open command window here” Option in Windows 11.)

Exit mobile version