Open Command Prompt from the Right Click Menu

· Windows Registry

Ok, I stole this one from somewhere and modified it to fit my needs. Half the time I forget it’s there, but sometimes I need a command prompt window in a folder thats nested a few levels deep. Instead of typing “cd” to change to every child folder, I found this registry file which allows you to right click on almost any folder or file and open a command prompt from that location. The right click menu will say, “.Selected Folder Prompt” or “..Parent Folder Prompt” depending on which object you click.

Place the code inside of a *.REG file and double click it to add the functionality to the registry. You can also uncomment (remove the semicolons) the last 3 lines to remove the the entries from the right click menu.

Windows Registry Editor Version 5.00

; This script creates context menu items that allow users to click on either a file
; or folder and open up a command prompt from either the current or parent folder

[HKEY_CLASSES_ROOT\Folder\shell\zCmd1]
@=".\Selected Folder Prompt"

[HKEY_CLASSES_ROOT\Folder\shell\zCmd1\Command]
@="cmd.exe /k pushd %L"

[HKEY_CLASSES_ROOT\Folder\shell\zCmd2]
@="..\Parent Folder Prompt"

[HKEY_CLASSES_ROOT\Folder\shell\zCmd2\Command]
@="cmd.exe /k "For %%a in (%cd% cls) do %%a""

[HKEY_CLASSES_ROOT\*\shell]

[HKEY_CLASSES_ROOT\*\shell\Cmd]
@="..\Parent Folder Prompt"

[HKEY_CLASSES_ROOT\*\shell\Cmd\Command]
@="cmd.exe /k "For %%a in (%cd% cls) do %%a""

; To remove the script
;[-HKEY_CLASSES_ROOT\Folder\shell\zCmd1]
;[-HKEY_CLASSES_ROOT\Folder\shell\zCmd2]
;[-HKEY_CLASSES_ROOT\*\shell]
author image

About Joseph Spurrier

I'm passionate about building solutions to automate tasks and improve efficiency. I worked for a few companies in the digital healthcare space. My education is in forensics. Tech guy. Traveler. Runner. Guitar player. Scotch and beer enthusiast. GitHub LinkedIn Twitter Google+

Share this post


Comments powered by Disqus