0

I have written DOS commands and GIT commands in notepad and convering to .BAT file.After executing the Batch file only DOS command will be executed GIT commands not executing.How do i run GIT commands using Batch(.BAT) file

3 Answers 3

4

Make sure that git is in your PATH system environment variable and if it is then you should be able to call git just like you normally would in the terminal. Please note that you will need to restart the terminal (cmd) for path changes to take effect.

Sign up to request clarification or add additional context in comments.

9 Comments

@Robert,i tried but it is not working.itwas logged and connected to GIT by running a batch file but commands were not executed..Please let me know your thoughts
@Aravinth Okay, can you do a few things for me, Type 'echo %PATH%' on the terminal and give me the output in a pastie. Then maybe show me a snippet of your batch file (or just dump your whole batch file in a pastie) and edit your question to post it so that I can see that information. With that data I should be able to spot what is going wrong or know what the next step is.
@Robert,`C:\Program Files\Windows Resource Kits\Tools\;C:\WINNT\system32;C:\WINNT;C:\WINN T\System32\Wbem;C:\WINNT\system32\nls;C:\WINNT\system32\nls\ENGLISH;c:\Program F iles\Novell\ZENworks\;C:\Program Files\Novell\SecureLogin\;c:\Program Files\Pers onal Communications\;c:\Program Files\IBM\Trace Facility\;C:\WINNT\system32\Wind owsPowerShell\v1.0;
@Aravinth: Um, where am I supposed to find it exactly?
@Robert,c:\Program Files\Microsoft SQL Server\100\Tools\Binn\VSShell\ Common7\IDE\;c:\Program Files\Microsoft SQL Server\100\Tools\Binn\;c:\Program Fi les\Microsoft SQL Server\100\DTS\Binn\;c:\Program Files\Microsoft SQL Server\90\ Tools\binn\;C:\git\tools\nant;Z:.;Y:.;X:.
|
1

The git command in Msysgit is implemented by using a batch file to wrap all the calls and run the correct executable with the correct environment variables. You can not execute a batch file from another batch file normally like you would an executable, you have to use a special command to run them. If my memory is correct that command is call and would be used as call git push for example.

Comments

0

Hai All, Finally I got the solution for my question.By using below code snippet, we can run the Git using BAT file

"c:\Program Files\Git\cmd\git.cmd" pull > c:\platform.txt

the above code using from BAT file instead of using git pull or git push and any git command using GIT Bash

Thanks to all for posting your valuable comments and partial answer

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.