Hi, I just noticed that there is a nice project named:
https://github.com/matveyt/shebangWith this project, we can run bash script from normal Windows CMD.
Here is my test which can correctly run "wx-config-3.1"(this is a bash script) from Windows CMD.
Step 1, get and build the shebang project
You just clone/download this project.
Under your local folder, inside the msys2's mingw64 compiler command line(started by double click the "mingw64.exe" under msys2 folder)
gcc -s shebang.c -o shebang.exe -lshlwapi -DUNICODE -D_UNICODE -municode
This will generate a "shebang.exe" in the same folder.
Step 2, rename this "shebang.exe" to the bash script executable name you want
I notice in my msys2's folder, there is a bash file named: "F:\msys2\mingw64\bin\wx-config", this file is for wx 3.0, and since I have installed wx 3.1 from pacman, there is another file named "F:\msys2\mingw64\bin\wx-config-3.1".
Now, let me try with the later script file "wx-config-3.1".
I need to copy/rename the "shebang.exe" to "wx-config-3.1.exe"
Step 3, prepare the PATH
I just start the Windows CMD window, and type something like:
set PATH=F:\msys2\usr\bin;F:\msys2\mingw64\bin;%PATH%
This will put the necessary tools in the PATH
Step 4, run the "wx-config-3.1.exe" from the CMD
Now, you can type such command inside your CMD
D:\code\shebang-master>wx-config-3.1.exe --cflags
-I/mingw64/lib/wx/include/msw-unicode-3.1 -I/mingw64/include/wx-3.1 -D_FILE_OFFSET_BITS=64 -DWXUSINGDLL -D__WXMSW__
D:\code\shebang-master>wx-config-3.1.exe --libs
-L/mingw64/lib -pipe -Wl,--dynamicbase,--high-entropy-va,--nxcompat,--default-image-base-high -Wl,--subsystem,windows -mwindows -lwx_mswu_xrc-3.1 -lwx_mswu_html-3.1 -lwx_mswu_qa-3.1 -lwx_mswu_core-3.1 -lwx_baseu_xml-3.1 -lwx_baseu_net-3.1 -lwx_baseu-3.1
You can see, when you run the wx-config-3.1.exe, it will internally call the msys' bash script engine.
One remaining bug:If I run the the same command inside the msys2' mingw64 shell, I got this:
# wx-config-3.1 --cflags
-IF:/msys2/mingw64/lib/wx/include/msw-unicode-3.1 -IF:/msys2/mingw64/include/wx-3.1 -D_FILE_OFFSET_BITS=64 -DWXUSINGDLL -D__WXMSW__
So, it looks like the returned path is not the same in the two cases.
Any one knows how to fix this issue? Maybe, I need to add some options?