find bash.exe location from a .bat file if only git.exe is in %PATH%

46 views
Skip to first unread message

Ilia Basin

unread,
Nov 22, 2024, 4:38:19 AM11/22/24
to git-for-windows
Hi. In my git for windows installation only git.exe is in path. I'm writing a wrapper .bat file that is supposed to launch the actual .sh file and I need to find the proper shell interpreter (and not launch WSL by accident). Can git print the location of bash it uses for hooks and other scripts?

Konstantin Khomoutov

unread,
Dec 2, 2024, 7:56:21 AM12/2/24
to Ilia Basin, git-for-windows
I do not know whether GfW provides "something" which you could "query"
to find the location of bash.exe, but possibly you could roll like this:

* The location of bash.exe may be expected to be reasonably stable
between GfW releases.

* It is supposedly also stable relative to the location of git.exe.

* Since git.exe is in the path, you could first locate its full pathname -
say, calling

where git.exe

if writing a batch (for cmd.exe), or something analogous in other
environments.

* Use other tools for path manipulation to construct the pathname
of bash.exe.

Reply all
Reply to author
Forward
0 new messages