Friday, February 18, 2011

Windows 7 Right Click Menu to Launch Cygwin

If you use Windows 7 and Cygwin here are instructions for creating a Windows 7 File Explorer right-click menu to lauch Cygwin (image on right).



Steps

1. Install Cygwin (here's a link to the download site). I installed mine to c:\programs\cygwin. We'll call this CYGWIN_HOME.

2. Add the CYGWIN_HOME to the system path

3. Create a file called runBash.bat in the CYGWIN_HOME\bin with the following lines:
  • @echo off
  • %~d1
  • chdir %~p1
  • cd %1
  • bash --rcfile ~/.bashrc -i
4. Use Regedit to add a registry entry called HKEY_CLASSES_ROOT\Directory\shell\bash with value of Bash Here...

5. Use Regedit to create another registry entry called HKEY_CLASSES_ROOT\Directory\shell\bash\command with a value of c:\programs\cygwin\bin\runBash.bat "%1"

6. That's it. Now you can right click in File Explorer and open a Cygwin window.