Example: Add A Command To The Folder Context Menu
This worked example shows a complete edit from start to finish. It adds an Open command prompt here entry to the right-click menu of folders, which opens a command prompt already pointed at the selected folder.
It uses the skills from the rest of this guide: navigating, creating keys, and editing the default value.
This example changes HKEY_CLASSES_ROOT, which affects all users. Export the HKEY_CLASSES_ROOT\Folder\shell key before you start, so you can restore it. See Export.
Steps
-
In the key tree, navigate to:
HKEY_CLASSES_ROOT\Folder\shell -
Create a new key under
shelland name it, for example,OpenCmd. Its name is internal; see the next step for the visible label. See Create Keys. -
Select the new
OpenCmdkey and edit its default value ((Default)) to the text you want to appear in the context menu, for example:Open command prompt here -
Under
OpenCmd, create another key namedcommand. -
Select
commandand set its default value to the command line to run:"C:\Windows\System32\cmd.exe" /k pushd "%V"%Vis replaced with the path of the folder you right-clicked. -
Test it: right-click a folder in Windows Explorer. The Open command prompt here entry now appears, and choosing it opens a command prompt in that folder.
The Same Change As A .reg File
You can achieve the same result by importing this file:
Windows Registry Editor Version 5.00
[HKEY_CLASSES_ROOT\Folder\shell\OpenCmd]
@="Open command prompt here"
[HKEY_CLASSES_ROOT\Folder\shell\OpenCmd\command]
@="\"C:\\Windows\\System32\\cmd.exe\" /k pushd \"%V\""
Note how the quotation marks and backslashes inside the command line are escaped in the .reg file (\" and \\). O&O RegEditor decodes these correctly on import.
Undoing The Change
To remove the entry, delete the HKEY_CLASSES_ROOT\Folder\shell\OpenCmd key (which also removes its command subkey), or re-import the branch you exported before you started.