How do I write a batch file which opens the GitBash shell and runs a command in the shell?

"C:\Program Files (x86)\Git\bin\sh.exe" --login -i -c "git archive master | tar -x -C $0" "%~1"

You can also run a shell script to run multiple commands

#! /bin/bash
cd /c/GitRepo/PythonScripts
git status
read -p "Press enter to continue"

then call that from your cmd line:

"c:\Program Files (x86)\Git\bin\sh.exe" --login -i -c "/c/GitRepo/PythonScripts/statusandwait.sh"

In windows I created a git.bat file, and associated it to the .hook extension.

if not exist %1 exit
set bash=C:\Program Files (x86)\Git\bin\bash.exe
"%bash%" --login -i -c "exec "%1""

After that you can run the .hook files like every .bat or .cmd file except that they are running under git shell...