Command Prompt AnywherePrint This Post
Any day you can walk up to my workstation at work and find a command prompt open. Whether it is a Windows CMD prompt or a Linux Shell; I actually prefer it over the Windows GUI and over a KDE or Gnome on Linux. I can generally get more done in a few keystrokes then mouse clicks, especially when you need to start a task and have a log of the outcome.
Some things the GUI is great for like exploring a file structure. Many times you are browsing the GUI and realize you need to drop to a command prompt to start a task. Rather than clicking ‘Start’, then ‘Run’, typing ‘CMD enter’ and then changing directory, it would be nice to right click and drop to a CMD prompt from the Windows context menu.
I have been using this little crafted registry hack for years now. There are two needs for a command prompt one is right clicking on a file or other object and the other is right clicking on a folder. The ‘Command Prompt Anywhere.reg’ below takes care of both instances. The first part edits the default context menu so that the ‘CommandPrompt’ shows up for files and objects not defined as a folder. The second part edits the folder context menu so that ‘CommandPrompt’ shows for folders.
There is one limitation It will not work for network locations, this is a limitation of using the ‘cd’ command and can be changed using the ‘pushd’ command. The ‘pushd’ command will temporarily map the network location to the first drive letter available starting from ‘Z’ and working backwards in the alphabet. However if the ‘cd’ command in the scripts is replaced with ‘pushd’ you will need to keep the network mappings tidy, by using either a ‘net use z: /d’ or ‘popd’ before you exit the prompt.
Windows Registry Editor Version 5.00 [HKEY_CLASSES_ROOT\*\shell] [HKEY_CLASSES_ROOT\*\shell\CommandPrompt] [HKEY_CLASSES_ROOT\*\shell\CommandPrompt\Command] @="cmd.exe /k cd \"%1/..\"" [HKEY_CLASSES_ROOT\Directory\shell] [HKEY_CLASSES_ROOT\Directory\shell\CommandPrompt] [HKEY_CLASSES_ROOT\Directory\shell\CommandPrompt\Command] @="cmd.exe /k cd \"%1\""
To install just copy and paste it to a file called ‘Command Prompt Anywhere.reg’,Â then double click it and answer ‘yes’ to the warning.