2022-02-16 00:53:01 -05:00
---
title: Git Bash undocumented command line
2022-05-06 22:49:33 -04:00
...
2022-02-16 00:53:01 -05:00
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` ](https://www.gnu.org/software/bash/manual/bash.html ) [are documented ](http://www.gnu.org/gethelp/ ).
`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`
2022-02-18 15:59:12 -05:00
"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
2022-02-16 00:53:01 -05:00
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
2022-02-18 15:59:12 -05:00
give you an error message.
2022-02-16 00:53:01 -05:00
`--no-hide`
Does not hide the console window.