在当前工作目录中打开 Cygwin.bat 个文件 (Windows 10)

Open Cygwin.bat file in current working directory (Windows 10)

Cygwin 新手,尝试从当前工作目录启动批处理文件。我之前使用注册表编辑器为 Windows 10 中的 .exe 文件做过类似的事情(参见 link):

https://www.windowscentral.com/how-launch-bash-shell-right-click-context-menu-windows-10

我的 Cygwin.bat 文件如下所示:

@echo off
SETLOCAL
set HOME=C:\path\to\home
C:
chdir C:\cygwin64\bin
bash --login -i
ENDLOCAL

但是,当我右键单击一个目录以 "Open Cygwin.bat here" 时,终端在 C:\path\to\home 处打开。如何确保终端在当前工作目录中打开?

要获得预期结果,您需要使用 chere 包。

chere -i 

通常足以在资源管理器鼠标左键菜单中创建适当的 Bash Prompt Here 条目。

请注意,无论如何都不推荐使用 cygwin.bat,因为不使用 mintty 作为终端