Invoking MSYS bash from Windows cmd

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.

Source


You don't have to use bash to execute make, or any of the other MSYS programs. If you put the MSYS bin directory on your path, you can execute them from a Windows command shell. Alternatively, the bash shell has an enormously powerful scripting language built in. But I'm not clear if that's what you are asking about - you should clarify your question with an actual example of what you want to do, spelling out the steps you want automated.

My own setup is to have a Windows Explorer context menu called "Bash here" which opens a bash shell in the directory I select. This is done via the following registry entries:

[HKEY_CLASSES_ROOT\Directory\shell\mybash]
@="Bash Here"

[HKEY_CLASSES_ROOT\Directory\shell\mybash\command]
@="cmd /c c:\\bash.cmd %1"

And the following bash.cmd file in c::

@echo off
title bash
cd %1%
bash

Note that the MSYS bin directory is on my path. And of course, any registry hacking is at your own risk.


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"

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"