Cygwin Prompt Here for tcsh

In a post I can no longer find, Scott Hanselman blogged about a registry entry to add a "Command Prompt Here" item to Windows' right-click context menu. This has, many times, saved me almost 30 seconds of opening cmd.exe and typing out a ridiculous CD statement. Since then, however, I've found myself using Cygwin a lot more than cmd as it gives me a lot more power in an environment with which I'm much more familiar.1

Because of my Cygwin-love, I've found myself using the Command Prompt Here context-menu item, and then immediately entering tcsh and doing what needs to be done. I can', then, double Ctrl-D my way out of the window since cmd has no clue what Ctrl-D is. It's annoying, but it means I have to take the extra two seconds to type 'exit'. So, throwing any concept of cost/benefit out the window [though, those four seconds probably add up to like... 30 minutes of lost productivity a year], I investigated how to do the same thing for Cygwin.

Somebody figured this out already, so all that was left was for me to have it run tcsh instead of bash, and I was all set. This was painfully simple. Here's the registry script I'm using:

1
2
3
4
5
6
7
8
9
10
11
12
REGEDIT4
[HKEY_CLASSES_ROOT\Directory\shell\TcshHere]
@="&Cygwin Prompt Here"

[HKEY_CLASSES_ROOT\Directory\shell\TcshHere\command]
@="c:\cygwin\bin\bash.exe --login -c \"cd '%1' ; exec /bin/tcsh\""

[HKEY_CLASSES_ROOT\Drive\shell\TcshHere]
@="&Cygwin Prompt Here"

[HKEY_CLASSES_ROOT\Drive\shell\TcshHere\command]
@="c:\cygwin\bin\bash.exe --login -c \"cd '%1' ; exec /bin/tcsh\""

  1. Some things are kinda wonky (pathnames, for instance) but it’s more user-friendly to me, and I can’t quite get into PowerShell like some of my more Windows-oriented friends.

Comments