git-bash is a mintty.exe wrapper and bash wrapper – it winds up invoking
other processes that do the actual work. While git-bash.exe is undocumented, mintty.exe and bash.exe are documented.
git-bash.exe sets up the environment in windows for bash.exe, then launches the bash shell
Example Windows shortcut to bash script: /x/src/wallet/docs/mkdocs.sh
"C:\Program Files\Git\git-bash.exe" --cd=X:\src\wallet --needs-console --no-hide --command=usr\bin\bash.exe --login -i docs/mkdocs.sh
Notice that the paths to the left of the invocation of bash are in Windows
format, and the paths to the right of the invocation of bash are in gnu
format.
Albeit this way of executing a bash script in windows is too clever by half, since you should be able to execute it just by clicking on it.
--cd=D:\src
Sets the initial working directory to /d/src (windows path, launches bash
with the corresponding gnu path)
--no-cd
does not set working directory.
--cd-to-home
Sets the working directory to home.
--command=command-line
Executes <command-line> instead of the embedded string resource.
--minimal-search-path
Ensures that only /cmd/ is added to the PATH instead of /mingw??/bin and /usr/bin/
--no-minimal-search-path
Normal search path
--needs-console
Ensures that there is a Win32 console associated with the spawned process
--no-needs-console
Fails to ensure that there is a Win32 console
--hide
Hides the console window. This makes sense if you are launching a script and
not expecting any feedback. But it means that the script has no means to
give you an error message.
--no-hide
Does not hide the console window.
reaction.la gpg key 154588427F2709CD9D7146B01C99BB982002C39F
This work is licensed under the Creative Commons Attribution 4.0 International License.