March 16, 2004

Neat Windows Shell Trick to Launch CMD Window

Today I learned a neat little shell trick thanks to my buddy Gareth.

Have you ever been browsing in Explorer and want to drop down to a CMD window at that point? Not easy. You can open a cmd window, drag the path in Explorer to the cmd window as a drop target and then go from there. But he showed me a neat hack to the registry to make it a right click menu option!

Steps to add this:

  1. Start regedit
  2. Open HKEY_CLASSES_ROOT\Directory\shell
  3. Add a new key called 'cmd' (without the quotes)
  4. Edit the (Default) string and name it whatever you want the menuitem to say. I put 'Open CMD here'
  5. Add a subkey called 'command' (without the quotes)
  6. Edit the (Default) string and add the following: cmd.exe /k "cd %L"

Now if you right click on a folder, you will have an 'Open CMD here' option which opens the cmd prompt right at that location!

Easy hack... really nice result.

Posted by SilverStr at March 16, 2004 10:03 AM | TrackBack
Comments

Cool... I'm pretty sure there's an ms-powertool that does something similar, an 'open command here' or something. Didn't know how it was done though. Thanks!

Posted by: Arcterex at March 16, 2004 11:28 AM

This trick is covered in O'Reilly's "Windows XP Hacks" under Hack #29 "Context Menu". You can see it (as well as a few other hacks) online from the good folks at ORA.

http://www.oreillynet.com/pub/a/network/excerpt/winxphacks_chap1/index1.html

Arcterex, the _PowerToy_ you're thinking of is called "Open Command Window Here". It can be had from the PowerToys page at: http://www.microsoft.com/windowsxp/pro/downloads/powertoys.asp

--Ian, who was looking this up a few weeks ago

Posted by: Felspar at March 16, 2004 03:45 PM

Yeah, I remember using the 'Command prompt here' thing in PowerToys from the Windows 95 days...

Posted by: Wim at March 17, 2004 05:12 PM

here is a little customization for you who prefer bash rather them lame cmd. As bash on win systems I use minimal gnu msys & rxvt from mingw distro - but you can probably use this little tip with something else as well.

Do same first 3 steps as above (call new key as u like);

4) change text to something miningfull (like 'bash here' for ex)
5) add a subkey (call it command as above)
6) Edit the (Default) string and add the following: "rxvt.exe"

Observe: you don't need to pass any commands to rxvt as above. System will automaticly open bash in a rxvt window in the directory you right-click on.

To obtain "minimal gnu system" go to mingw homepage: http://www.mingw.org/download.shtml .
__________________________________________________
"At eight day God started debugging."

Posted by: smiley_horse at May 24, 2004 05:48 PM