Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Execute commands from .bat file on Git Bash Terminal

Tags:

I am newbie to Git bash.

Just out of curiosity trying to make a .bat file which contains commands(Dont know if Git Bash supports .bat file)

What I want to achieve is simply drag and drop this .bat file to Git Bash terminal and commands in the file get executed(Is it possible?).

My commands in .bat file

cd "C:\Users\USER\abc\xyz" cd "C:\Users\USER\abc\xyz\pqr" export HOME="C:\Users\USER\some_directory" export HOME2="C:\Program Files\directoy" 
like image 271
Shabbir Panjesha Avatar asked Mar 14 '14 06:03

Shabbir Panjesha


People also ask

Can we run bat file in Git bash?

You call them as you would .exe's, normally omitting the extension. Unfortunately, these . bat files are not available inside Git Bash shells, as Git Bash fails to look them up as it does .exe's. Even when PATH is set properly, Git Bash throws its hands up as to where a batch program lies.

How do I run code in Git bash?

Launch Git Bash console by clicking on the Start button, type git, and click on Git Bash. 2. Run the below git config command to add your name ( YourName ) as your git username ( user.name ). The git config command administers configuration variables that control how Git looks and operates.


1 Answers

You can run batch files just from git bash e.g.

 ./clear.bat  

From Out of a git console: how do I execute a batch file and then return to git console?

like image 155
Michael Freidgeim Avatar answered Oct 13 '22 13:10

Michael Freidgeim