LOGO

Add Command Prompt to Right-Click Menu in Windows

November 25, 2006
Add Command Prompt to Right-Click Menu in Windows

Accessing the Command Prompt Directly from Windows Explorer

Windows incorporates a useful, yet often overlooked, feature that enables users to launch a command prompt directly from a selected directory. This is achieved by right-clicking on a folder and choosing the "Command Prompt Here" option from the context menu.

Implementing this functionality requires a minor adjustment to the Windows Registry. It is strongly recommended to create a registry backup before proceeding, as a precaution against any unforeseen issues.

Step-by-Step Registry Modification

Begin by opening the Registry Editor. Type "regedit.exe" into the Start/Run dialog box to initiate the application.

Navigate through the registry tree to the following key:

HKEY_CLASSES_ROOT\Directory\shell

Within this key, right-click in the right-hand pane and select "New" then "Key".

Assign the name "CommandPrompt" to the newly created key, ensuring no quotation marks are used. Subsequently, double-click the "Default" value within this key.

Modify the value data to read "Command Prompt Here", mirroring the desired menu entry text.

Right-click on the "CommandPrompt" key you just created and select "New" then "Key" again.

Name this new key "Command". Then, double-click the "Default" value within the "Command" key.

Enter the following command as the value data:

cmd.exe /k cd %1

Following these steps, a right-click on any folder within Windows Explorer should now present the "Command Prompt Here" option.

Selecting this option will open a command prompt window with the current directory already set to the selected folder.

Alternative Method: Using a .reg File

For convenience, the registry modifications can also be applied using a pre-configured .reg file. Create a new text file and name it with a ".reg" extension (e.g., "cmdprompt.reg").

Paste the following code into the text file:

Windows Registry Editor Version 5.00

[HKEY_CLASSES_ROOT\Directory\shell\CommandPrompt]

@="Command Prompt:"

[HKEY_CLASSES_ROOT\Directory\shell\CommandPrompt\Command]

@="cmd.exe /k cd %1"

Double-click the created .reg file to import the settings into the registry. This will automatically implement the "Command Prompt Here" functionality.

This streamlined approach offers a quicker alternative to manual registry editing, achieving the same outcome.

#command prompt#windows#right-click menu#windows explorer#tutorial#command line