11

I installed new version of MSysGit and now I am not able to run *.bat files directly from command line("called MINGW64").

I try to search it, but I only saw options which needs run cmd first. Out of a git console: how do I execute a batch file and then return to git console? cmd "/C clean.bat"

Is there some option to just run the clean.bat?

Thank you very much


I solve that by updating all libraries... Maybe Cygwin? I am not sure, but update all your software and it works.

Manic Depression
  • 1,000
  • 2
  • 16
  • 34
  • Maybe a shebang at the start of the file such as `;!cmd.exe /c`? Other than that, no, there probably isn't a way to do what you're asking. –  Oct 24 '15 at 05:55
  • 3
    You have to use cmd.exe , as windows isn't smart enough to know which shell can execute a batch file – jeb Oct 24 '15 at 08:42
  • When I use old version of MSysGit, I can run directly `clean.bat` – Manic Depression Oct 24 '15 at 13:15
  • Why not make a `bash` alias instead of using a batch file? Or make a `clean` alias that will run `cmd /c clean.bat`. – wOxxOm Oct 24 '15 at 16:08

2 Answers2

12

Try this from MINGW command line

$ cmd <test.bat
Guest77734
  • 121
  • 1
  • 3
  • Note there should be space between the "<" and "test.bat" if you want it to run in the same console window. Having no space will open a new window. – Nap Feb 27 '20 at 00:08
  • Note that mingw requires the .bat file to have the line break in the end, or else the last line will be ignored – Anton Duzenko May 12 '23 at 08:51
0

Try this from MINGW command line

$ eval "./test.bat"

D:\workspace>echo hello world
hello world