I am provided a .bat file which some script I need to execute. I have the Git bash mintty console for Windows and want to run it from there. From a normal Windows console it works normally but in mintty I get :
$ script.bat
bash: script.bat: command not found
How do I do this ?
You probably tried to execute script.bat
that is located in your current directory. Windows Command Prompt searches the current directory first, finds the script and executes it. Bash never searches an executable file in the current directory, it looks for them files only in the paths declared in $PATH
.
In order to run a program that is located in a path not specified in $PATH
, in Bash you have to invoke it using a path that includes a slash (/
). This means to run the .bat
script from the current directory you have to invoke it as:
$ ./script.bat