Bohack

Check In and Tune Out!
 
 
« Redirect HTTP to SSL with IIS
How To Turn an old Xbox into an Xbox Media Center – Part 1 »

Command Prompt Anywhere



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.

Command Prompt Anywhere

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.

Tags: CMD, Windows

This entry was posted on Sunday, December 14th, 2008 at 2:06 pm and is filed under Windows.
You can follow any responses to this entry through the RSS 2.0 feed.
Both comments and pings are currently closed.

One Response to “Command Prompt Anywhere”

  1. KrispyKritter Says:
    February 14th, 2009 at 5:49 am

    I will use this one, thanks.

    Lost my version somewhere, somewhen.

  • Channels

    • Beer (2)
    • Blog (1)
    • Exchange (2)
    • Ham Radio (1)
    • Homebrew (3)
    • Linux / Unix (4)
    • Misc (1)
    • Mods (4)
    • Networking (1)
    • Programming (4)
    • Recipes (2)
    • Scripts (7)
    • Security (1)
    • Software (2)
    • Spam (1)
    • Telco (7)
    • Virtual PC (1)
    • VMware (3)
    • VOIP (3)
    • Windows (16)
    • Windows 2008 (4)
    • Windows 7 (5)
  • Archives

    • September 2012
    • April 2012
    • March 2012
    • February 2012
    • January 2012
    • November 2011
    • September 2011
    • July 2011
    • April 2011
    • February 2011
    • January 2011
    • October 2010
    • August 2010
    • February 2010
    • January 2010
    • December 2009
    • November 2009
    • June 2009
    • May 2009
    • February 2009
    • January 2009
    • December 2008
    • November 2008
    • October 2008
  • Links

    • Blogarama Blogarama – The Blog Directory
    • BlogHub Blog Directory
    • Blogrankings Technology Blogs – Blog Rankings
    • Blogville.us blogville.us
    • Buzzerhut free directory | buzzerhut.com
    • Ontoplist Online Marketing
    • Primechoiceautoparts Discount Auto Parts
    • PTC My Employer
 

  Copyright - Bohack 2025 ©