To restore the classic "Open Command Prompt here" option in Windows 10 File Explorer, you must modify the Windows Registry. Microsoft replaced this feature with PowerShell by default in later updates. By editing specific registry keys under HKEY_CLASSES_ROOT, you can re-enable the legacy context menu item for folders and drives, allowing users to quickly launch cmd.exe instead of PowerShell.
Understanding the Context Menu Change
In earlier versions of Windows 10, right-clicking a folder or drive in File Explorer provided a straightforward "Open Command Prompt here" option. This was highly valued by system administrators and developers who preferred the stability and syntax of the traditional Command Prompt over PowerShell. However, as part of Microsoft's push toward modernizing the command-line interface, this option was deprecated and replaced with "Open PowerShell window here." While PowerShell is more powerful, many users find it slower to start or less compatible with legacy scripts that rely on CMD-specific behaviors. Restoring the old behavior does not require third-party tools; it can be achieved entirely through built-in system utilities. The process involves creating new registry entries that mimic the original functionality. It is important to note that these changes affect the shell experience globally for the current user profile. Before proceeding, ensure you understand the implications of modifying the registry, as incorrect edits can lead to system instability.Creating the Registry Fix
The most reliable method to bring back the Command Prompt option is to create a custom registry file. This approach ensures that all necessary paths and parameters are correctly formatted without manual typing errors. You will need to use Notepad to create a text file that contains the registry commands. First, open Notepad. You can do this by searching for "Notepad" in the Start menu or pressingWin + R, typing notepad, and hitting Enter. Once the blank document is open, you will need to paste the following code block into it. This script defines two main sections: one for folders and one for the directory background (right-clicking empty space in a folder).
Windows Registry Editor Version 5.00
[HKEY_CLASSES_ROOT\Directory\shell\OpenCmdHere]
@="Open Command Prompt here"
"Icon"="cmd.exe"
[HKEY_CLASSES_ROOT\Directory\shell\OpenCmdHere\command]
@="cmd.exe /s /k pushd \"%V\""
[HKEY_CLASSES_ROOT\Directory\Background\shell\OpenCmdHere]
@="Open Command Prompt here"
"Icon"="cmd.exe"
[HKEY_CLASSES_ROOT\Directory\Background\shell\OpenCmdHere\command]
@="cmd.exe /s /k pushd \"%V\""
[HKEY_CLASSES_ROOT\Drive\shell\OpenCmdHere]
@="Open Command Prompt here"
"Icon"="cmd.exe"
[HKEY_CLASSES_ROOT\Drive\shell\OpenCmdHere\command]
@="cmd.exe /s /k pushd \"%V\""
Each section targets a different context within File Explorer. The Directory key applies when you right-click a folder icon. The Directory\Background key applies when you right-click the white space inside a folder. The Drive key applies when you right-click a drive letter in the left navigation pane or in "This PC". The "Icon"="cmd.exe" line ensures that the menu item displays the familiar blue terminal icon rather than the generic gear or arrow.
Saving and Executing the Registry File
After pasting the code into Notepad, you must save the file with the correct extension. Click File > Save As. In the "Save as type" dropdown, select All Files (*.*). Name the file something recognizable, such asrestore-cmd.reg. Ensure the extension is exactly .reg, not .txt. Save this file to your Desktop or Documents folder for easy access.
Once saved, locate the .reg file. Double-click it to initiate the import process. Windows will display a security warning asking if you want to proceed with adding the information to your registry. Click Yes. If prompted by User Account Control (UAC), confirm the action. Upon successful completion, you will see a message stating that the registry entries have been added successfully.
To verify the change, open any File Explorer window. Right-click on a folder, the empty space within a folder, or a drive. You should now see "Open Command Prompt here" in the context menu. When selected, it will launch a Command Prompt window already positioned in that specific directory. The /k pushd "%V" parameter in the registry value ensures that the command prompt starts in the correct path and remains open after execution, which is often preferred for batch operations.
For those interested in automating other PowerShell tasks, you might also check out Opt in Microsoft Automatic Updates using PowerShell to learn how to manage system settings programmatically. Additionally, understanding how to generate file lists efficiently can complement your command-line workflow, as detailed in Automatically Generate List Files with Filename and Folder Names using Windows CMD or PowerShell.
Reverting the Changes
If you decide that you prefer PowerShell or wish to undo this modification, you can remove the added registry keys. Create another Notepad file and paste the following code, ensuring you include the minus signs (-) before each registry path. These minus signs tell the registry editor to delete the specified keys.
Windows Registry Editor Version 5.00
[-HKEY_CLASSES_ROOT\Directory\shell\OpenCmdHere]
[-HKEY_CLASSES_ROOT\Directory\Background\shell\OpenCmdHere]
[-HKEY_CLASSES_ROOT\Drive\shell\OpenCmdHere]
Save this file as remove-cmd.reg and double-click it to execute. After confirming the prompts, the "Open Command Prompt here" option will disappear from the context menu, reverting to the default state where only PowerShell options are available. This clean removal prevents orphaned registry entries from cluttering your system.
Troubleshooting Common Issues
Sometimes, the registry edit may not appear immediately. This can happen due to caching issues in File Explorer. To force a refresh, you can restart File Explorer. Open Task Manager (Ctrl + Shift + Esc), find Windows Explorer in the processes list, right-click it, and select Restart. Alternatively, simply restarting your computer will apply the changes fully.
If the option appears but fails to open a command prompt, check the registry path again. Ensure there are no typos in the command subkey. The value should be exactly cmd.exe /s /k pushd "%V". Any deviation, such as missing quotes around %V, can cause the command to fail or open in the wrong directory. Also, ensure that cmd.exe is still present in your C:\Windows\System32 folder, although this is rare on standard Windows installations.
Frequently Asked Questions
Does this work on Windows 11?
Yes, the registry structure is largely similar between Windows 10 and 11. However, Windows 11 has its own context menu implementation that may hide older items. You might need to click "Show more options" to see the restored CMD entry, or use third-party tools like ShellExView to manage the menu visibility more effectively.Will this change affect Administrator privileges?
No, this change only affects the starting directory and the application launched. If you need an elevated Command Prompt, you must still right-click the shortcut or search for CMD and select "Run as administrator." The registry fix does not automatically grant administrative rights upon opening the menu.Can I customize the icon for the menu item?
Currently, the registry script sets the icon tocmd.exe. You can change this to any other executable or DLL file that contains icons, such as shell32.dll or imageres.dll, by modifying the "Icon" value. For example, you could point it to a specific index number within a DLL to get a different visual style.