无法在 Windows10 上使用 Git Bash 界面的 运行 shell 脚本

Cant run shell script using Git Bash interface on Windows10

关注 this post 我无法 运行 shell 通过 Git bash。 这是批处理文件:

%ComSpec% /c ""C:\Program Files\Git\git-bash.exe" --login -i -- C:\Users\rmrd001\Documents\Git\scripts\first\test.sh"
pause

这是 shell 脚本:

echo Hello, World!

这是我在批次为 运行:

时得到的结果

我可以看到 bash 程序的瞬间外观 运行ce,但无法将文本捕捉到其中。 我对路径进行了两次三次检查,它们是正确的。 我 运行 脚本通过 Git bash,一切正常(消息出现)。

有什么想法吗?

我看过一个

我只看到消息:

start "" git-bash.exe -i -l -c "/C/path/to/script.sh"

script.sh 包括 a pause:

echo Hello. World!
read -n1 -r -p "Press any key to continue..." key

OP Hairi report 使其适用于:

start /b cmd /c "C:/Program Files/Git/git-bash.exe" /C/path/to/script.sh