How to invoke a shell on a directory through Windows Explorer

In the past, there used to be the Microsoft PowerToys for Windows XP which would add in the capability of invoking a Cmd shell on a directory through Windows Explorer.  You could right click on the diretory, and it would have a pop-up item available to do just that.  But, PowerToys is not supported for Vista.  Instead, Microsoft added the capability directly into the OS.  To execute a Cmd shell on a directory, hold the SHIFT key while doing a mouse right click, and select “Open Command Window Here”.

Unfortunately, Cmd is not my favorite shell–if you can even call it that.  I like using the Bourne-Again Shell (bash), which is available with the Cygwin package (http://cygwin.com).  Here is a handy little Regedit script I developed which seems to do the trick.

Windows Registry Editor Version 5.00
[HKEY_LOCAL_MACHINE\SOFTWARE\Classes\Folder\shell\Bash Prompt]
@="Bash Prompt"
[HKEY_LOCAL_MACHINE\SOFTWARE\Classes\Folder\shell\Bash Prompt\command]
@="cmd /k \"pushd %1 && set CHERE_INVOKING=y && c:\\cygwin\\bin\\bash.exe -il\""

NOTE: An updated version of this registry hack which uses mintty is available at http://codinggorilla.com/code/cs-mintty.reg.

Posted in Tip