Super User is a question and answer site for computer enthusiasts and power users. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I wish to add a command on right click menu in explorer that opens current directory with cygwin.

For same I have successfully added these registries:

[HKEY_CURRENT_USER\software\classes\directory\shell\cygwin]
@="c:\\cygwin\\bin\\bash.exe --login -i -c \"cd '%1'; bash\""

[HKEY_CURRENT_USER\software\classes\drive\shell\cygwin]
@="c:\\cygwin\\bin\\bash.exe --login -i -c \"cd '%1'; bash\""

but this adds the command only when on some folder or drive. I want generic right click on explorer, on which, search gives me this registry to edit:

[HKEY_CLASSES_ROOT\Directory\Background\shell\cygwin]
@="c:\\cygwin\\bin\\bash.exe --login -i -c \"cd '%1'; bash\""

My problem lies with the value of the key, which doesnt work on %1 but on some static value like /cygdrive/c

Could someone please tell me the proper way to pass current directory to the command, also please refer me some basic and advanced pages for same.

share|improve this question

migrated from stackoverflow.com Mar 18 '11 at 20:27

This question came from our site for professional and enthusiast programmers.

I think this is what the chere package does. Instead of tweaking the registry entries yourself, it might be easiest just to install that.

share|improve this answer

Better option - No registry edit -- http://perfect-blog-url.blogspot.com/2013/04/open-cygwin-with-right-click-no.html

On Win 7:

  1. Right click and Open Cygwin as Administrator.
  2. type "chere -i" or "chere -i -t mintty" if you would like to use Mintty which I personally prefere.
share|improve this answer
2  
Please add a bit of summary, the link will break sometime. – vonbrand Apr 23 '13 at 23:34
    
This worked for me, but I had to install the chere package first, and run it as chere -i -s bash. – Brian Z Jan 28 at 22:03

This is actually better than Cygwin’s chere in my opinion because it only launches once instance of bash.exe. If you look in Task Manager you will notice chere requires 2 instance of bash.exe to work. Not a huge deal but unecessary and annoying.

'directory', 'directory\background', 'drive' |
% {'cmd /c start /d "%v" bash' | ni -f hklm:\software\classes\$_\shell\bash\command}

Source

share|improve this answer

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .