Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

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

Given a standard installation of Cygwin for Windows XP, I would like to create a standard Explorer shortcut that opens a bash shell already open on a directory of my choosing. The directory is a UNC path. The standard cygwin.bat doesn't work because it invokes cmd.exe, and cmd.exe does not like UNC paths. Ideally, it doesn't start cmd.exe or any other shell to open bash. I've tried manipulating .bashrc and dredging my memory from my Unix days, but sadly that's lacking these days. Various solutions I've tried are almost working, but not quite.

share|improve this question
Related on Stack Overflow: Open Cygwin at a specific folder – Palec Jan 4 at 12:41
up vote 10 down vote accepted

I haven't toyed with UNC paths, but in general you have to use forward slashes instead of backslashes I believe. For regular drives, you can use /cygdrive/c for example to access the C drive.

In a batch file, to open the shell to the root of C: you could use:

c:\cygwin\bin\bash.exe --login -i -c 'cd "/cygdrive/c";bash'

You may also be interested in chere a context menu entry for Open bash here:

alt text

share|improve this answer
Another reason to use chere is that it allows you to choose what terminal you want to open, the default cygwin terminal is a bit clunky IMO. I have it to open an rxvt terminal instead. – Nifle Mar 3 '10 at 12:10
Thanks for your answer. I see where one of my attempts went wrong: no ;bash after the cd! Thanks also for the context menu entry... – Kit Mar 4 '10 at 17:47

I added a subfolder in registry at HKEY_CLASSES_ROOT/Directory/shell, added key Cygwin with key command where the command's value is

cmd.exe /k "E:\PATHTOCYGWIN\bin\bash --login -i -c "cd ""%L"";bash""
share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.