Return to Home Page
      Blog     Consulting     Seminars     Calendar     Books     CD-ROMS     Newsletter     About     FAQ      Search

"Cygwin Prompt Here"

This page shows a number of different ways that I have found to modify your Windows environment so that you can right-click on a folder in a Windows navigation tool and get a "Cygwin Prompt Here" option. These techniques were given to me by other people. I have tried to organize them such that what I think are the best approaches appear at the top of the page.

(From: Michael A Chase)

How do I add Cygwin to folder context menus?

To have Windows Explorer start a Bash console or rxvt window in any directory, save the following lines to a file with a .reg extension, change the command lines to point to where bash.exe and rxvt.exe are installed, and run the file.

You can change the string that appears in the context menu by changing "&Bash This" or "rxvt Here" to your prefered string. The character after '&' is the shortcut key for the command.

Run 'man rxvt' to see the options available for customizing the rxvt window.


@="&Bash This"

@="c:\\cygwin\\bin\\bash.exe --login -c \"cd '%1' ; exec /bin/bash -rcfile ~/.bashrc\""

@="&Bash This"

@="c:\\cygwin\\bin\\bash.exe --login -c \"cd '%1' ; exec /bin/bash -rcfile ~/.bashrc\""

@="rxv&t Here"

@="C:\\cygwin\\bin\\rxvt.exe -bg black -fg white -sr -sl 1000 -fn \"Fixedsys\" -ls -e /usr/bin/bash --login -c \"cd '%1'; exec /bin/bash -rcfile ~/.bashrc\""

@="rxv&t Here"

@="C:\\cygwin\\bin\\rxvt.exe -bg black -fg white -sr -sl 1000 -fn \"Fixedsys\" -ls -e /usr/bin/bash --login -c \"cd '%1'; exec /bin/bash -rcfile ~/.bashrc\""

(From Greg Finney)
This worked on WindowsXP Home, YMMV with other windows platforms, possibly with the registry script.

1. add the line

. .cygwin_new_location

to your .profile or .bash_profile in your cygwin home directory

2. Go to the cygwin install directory, (typically c:\cygwin), and copy cygwin.bat to cygwin_cmd_here.bat

3. Create a registry script for an explorer right-click option to open a cygwin window. Enter the following lines into a file ( adapted from Microsoft Windows XP Inside Out ), save with a .reg extension. You may need to modify the path to cygwin_cmd_here.bat for your system

Windows Registry Editor Version 5.00
[HKEY_CLASSES_ROOT\Folder\shell\Cmd Here]
@="Cygwin &Prompt Here"
[HKEY_CLASSES_ROOT\Folder\shell\Cmd Here\command]
@="cmd.exe /k c:\cygwin\cygwin_cmd_here.bat %L"

4. Double click on the file created in step #3 to add those keys to the registry

5. Edit the cygwin_cmd_here.bat file as follows -- replace below with your username

@echo off
chdir C:\cygwin
echo cd '%1 %2 %3 %4 %5 %6 %7 %8 %9' > home/username/.cygwin_new_location
bin\bash.exe --login -i

6. You should now be done : choosing 'Cygwin Prompt Here' when right clicking on a folder should launch the batch script, creating a command to cd to the folder directory that will be executed when your bash login process sources your .profile or .bash_profile

Other solutions (not necessarily tested/working):
Search     Home     WebLog     Consulting     Seminars     Calendar     Books     CD-ROMS     Newsletter     About     Contact     Site Design     Server Maintenance     Powered by Zope
©2007 MindView, Inc.