如何编写一个打开GitBash shell并在shell中运行命令的批处理文件? [英] How do I write a batch file which opens the GitBash shell and runs a command in the shell?
本文介绍了如何编写一个打开GitBash shell并在shell中运行命令的批处理文件?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我在Windows 7上尝试使用批处理文件打开GitBash shell并进行git调用。
这是我的批处理文件的内容:
REM打开GitBash
C:\Windows\\ \\ SysWOW64 \ cmd.exe / cC:\程序文件(x86)\Git\bin\sh.exe--login -i
REM检索存档
git归档master | tar -x -C%〜1
REM退出GitBash
退出
I注意到GitBash在下一个命令git archive ...之前注销。有人知道我是否可以将命令传递给GitBash吗?
Mike
解决方案 (C)\程序文件(x86)\Git\bin\sh.exe--login -i -cgit archive master | tar - x -C $ 0%〜1
I'm on Windows 7 trying to use a batch file to open the GitBash shell and make a git call. This is the contents of my batch file:
REM Open GitBash
C:\Windows\SysWOW64\cmd.exe /c ""C:\Program Files (x86)\Git\bin\sh.exe" --login -i"
REM retrieve archive
git archive master | tar -x -C %~1
REM quit GitBash
exit
I noticed that the GitBash is logging out before the next command "git archive...". Does anybody know if I can pass the command into GitBash and how?
Mike
解决方案
"C:\Program Files (x86)\Git\bin\sh.exe" --login -i -c "git archive master | tar -x -C $0" "%~1"
这篇关于如何编写一个打开GitBash shell并在shell中运行命令的批处理文件?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文