可以调用git.command将输出写入文件吗?

时间:2014-06-19 18:29:23

标签: git batch-file cmd

我需要从批处理文件中调用git log并将数据附加到文件中。我已经研究并尝试调用git.exe,git.cmd,最后是下面的批处理行给了我一个错误。有什么建议吗?

批处理文件中的命令:

call "C:\Program Files (x86)\Git\cmd\git.cmd" log --pretty="format:<author>%an</author>%n<date>%ai</date>%n<msg>don't care</msg>%n" --name-only >> "output.txt"

回应:

'"C:\Program Files (x86)\Git\cmd\git.cmd"' is not recognized as an internal or external command operable program or batch file.

1 个答案:

答案 0 :(得分:0)

尝试并简单地调用git:如果它在您的%PATH%中,则.bat脚本将能够执行它(不需要call

git log --pretty="format:<author>%an</author>%n<date>%ai</date>%n<msg>don't care</msg>%n" --name-only >> "output.txt"

如此处所示,您可能必须转义某些字符或将'%'加倍,以确保避免%...被CMD shell会话解释。

相关问题