Julien Baldy
Julien Baldy

Reputation: 427

How to run something in Git Bash from Windows command

I use this Windows command to open 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.
How can I do to run a script from Windows command on Git Bash?

I want that Git Bash run git ex (a script from me) when it is open.

Upvotes: 0

Views: 12461

Answers (1)

VonC
VonC

Reputation: 1323115

You don't need to call bash or sh to run a bash script from DOS.

Simply write your bash script in a file called git-xxx (replace xxx by something more expressive) (no extension).

Then, from your DOS (provided your %PATH% include <git>/bin), call:

git xxx

That will launch the git-xxx script (it needs to be somewhere in your PATH too), through the git bash.exe session.

Upvotes: 4

Related Questions