[英]How to run something in Git Bash from Windows command
I use this Windows command to open Git Bash:我使用这个 Windows 命令打开 Git Bash:
start "" "%SYSTEMDRIVE%\Program Files (x86)\Git\bin\sh.exe" --login
start "" "%SYSTEMDRIVE%\Program Files\Git\bin\sh.exe" --login
I want to run a script from Git Bash now.我现在想从 Git Bash 运行一个脚本。
How can I do to run a script from Windows command on Git Bash?如何在 Git Bash 上从 Windows 命令运行脚本?
I want that Git Bash run git ex
(a script from me) when it is open.我希望 Git Bash 在打开时运行git ex
(我的脚本)。
You don't need to call bash
or sh
to run a bash script from DOS.您不需要调用bash
或sh
从 DOS 运行 bash 脚本。
Simply write your bash script in a file called git-xxx
(replace xxx
by something more expressive) (no extension).只需在名为git-xxx
的文件中编写您的 bash 脚本(用更具表现力的内容替换xxx
)(无扩展名)。
Then, from your DOS (provided your %PATH%
include <git>/bin
), call:然后,从您的 DOS(前提是您的%PATH%
包含<git>/bin
),调用:
git xxx
That will launch the git-xxx
script (it needs to be somewhere in your PATH too), through the git bash.exe
session.这将通过 git bash.exe
会话启动git-xxx
脚本(它也需要在您的 PATH 中的某个位置)。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.