A tweak to open Cygwin Bash shell from Windows Explorer context menu.
Just run Install Cygwin-Bash-Here.reg
file.
The script assumes that Cygwin is installed to C:/cygwin
or C:/cygwin64
.
- Right click on the Desktop, or any folder, or a folder background.
- Choose
Cygwin Bash Here
(or pressb
instead).
Yes, there is another way to achieve the similar result: install chere
package and run chere -i -t mintty
But there are 2 problems:
-
chere
's command doesn't work with paths having non-ASCII characters likeC:/Проект/dist
. The home directory (~
) is being open instead. -
chere
's command doesn't open the currently selected folder (Not opened. Selected).
It adds a simple command to HKCR\Directory\shell
and HKCR\Directory\Background\shell
:
"C:\cygwin\bin\mintty.exe" --dir "%V" -e /bin/env CHERE_INVOKING=1 /bin/bash --login
The command starts the mitty
terminal with the --dir
option mentioned in the mintty docs, then it sets CHERE_INVOKING
environment variable and runs bash
.
CHERE_INVOKING
is needed to prevent Bash change the working dir to user's home (see cygwin64/etc/profile
).