Posts Tagged batch

Making Cygwin more handy

I enjoy having Cygwin installed on Windows and often like to use the shell commands (grep, find, etc.). However, it’s inconvenient to spawn a new terminal window and slog through the often-complex Windows directory structure. Based off of some websites I found, I now have a way to make this work…

Create a batch script file in your Cygwin /bin folder (for me, this is C:\Cygwin\bin) with the following:

@cd /d %1
 
@bash --rcfile BASCHRC -i

Create a file called “bashcontext.reg” and save the following text into it:

[HKEY_CLASSES_ROOT\Directory\shell\bash]
@="Open Bash shell here"
 
[HKEY_CLASSES_ROOT\Directory\shell\bash\command]
@="C:\\Cygwin\\bin\\runBash.bat \"%1\""
 
[HKEY_CLASSES_ROOT\Drive\shell\bash]
@="Open Bash shell here"
 
[HKEY_CLASSES_ROOT\Drive\shell\bash\command]
@="C:\\Cygwin\\bin\\runBash.bat \"%1\""
 
[HKEY_CLASSES_ROOT\*\shell\bash]
@="Open Bash shell here"
 
[HKEY_CLASSES_ROOT\*\shell\bash\command]
@="C:\\Cygwin\\bin\\runBash.bat \"%1\""

You can add the registry information by double-clicking the file to run it.

Now on every directory you have a “Open Bash shell here” option that will take you there immediately. Handy!

Here’s a screenshot showing my cluttered context menu:

clutteredcontext.png

, , , , ,

1 Comment