Invoking MSYS bash from Windows cmd
Solution 1
Not an MSYS expert, but does something like this work for you:
rem Call this something like compile-project.bat
c:
cd \src\project
bash -c "make"
Solution 2
Just add executables to your Windows PATH:
C:\msys64\mingw64\bin
C:\msys64\usr\bin
Keep in mind, this adds a lot of executables to your path which might conflict with other applications. The ..\usr\bin
directory contains all installed MSYS2 packages. There is a lot of unnecessary stuff. ..mingw64\bin
directory has a smaller list.
Solution 3
On my MSYS-1.0.11
with the MSYS developers packages, I can call a bash script (CurrentScript.sh
) with a cmd/bat file in the current folder with this command:
R:\MinGW\MSYS-1.0.11\bin\sh "%cd%\CurrentScript.sh"
Taco de Wolff
Updated on June 15, 2022Comments
-
Taco de Wolff almost 2 years
I'm using GCC on Windows 7 (using the TDM's build). I installed MSYS to be able to execute Make and compile using makefiles. However, it is tedious to every time start up the MSYS Bash shell, navigate to the directory of the project and run
make
.What I want is to automate this process. I prefer to have a batch file in Windows, or something similar, from which I then invoke the MSYS Bash shell. It should navigate to the directory the batch file resides in and call
make
.Is this possible? Can I send commands to MSYS Bash from cmd (like navigation/invoking
make
)? Or can I let the MSYS Bash run a "Bash script", which sets the commands to be executed much like batch scripts?PS: This is something similar to Stack Overflow question Executing MSYS from cmd.exe with arguments.
-
Taco de Wolff about 14 yearsYes it does! Thanks a bunch :)