The Computer Oracle

How do I create a shortcut that opens Cygwin bash shell on a directory of my choosing (UNC especially)?

--------------------------------------------------
Rise to the top 3% as a developer or hire one of them at Toptal: https://topt.al/25cXVn
--------------------------------------------------

Music by Eric Matyas
https://www.soundimage.org
Track title: Flying Over Ancient Lands

--

Chapters
00:00 How Do I Create A Shortcut That Opens Cygwin Bash Shell On A Directory Of My Choosing (Unc Especiall
00:49 Accepted Answer Score 12
01:14 Answer 2 Score 1
01:27 Thank you

--

Full question
https://superuser.com/questions/115587/h...

--

Content licensed under CC BY-SA
https://meta.stackexchange.com/help/lice...

--

Tags
#bash #shell #cygwin #unc

#avk47



ACCEPTED ANSWER

Score 12


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




ANSWER 2

Score 1


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""