如果在PowerShell中v3的试试这个:
$out = git log ORIG_HEAD --% --no-merges --date=short --pretty="format:<tr><td>%h</td><td>%ad</td><td>%an</td><td>%s</td></tr>"
$out > test.txt
的 - 放在%的PowerShell成不同的解析模式更适合本地的可执行文件。有关更多详细信息,请参阅此blog post。
如果你还没有使用PowerShell v3的,我建议你使用从PowerShell Community Extensions echoargs看到论据git.exe从PowerShell中接收它们如:
PS> echoargs log ORIG_HEAD --no-merges --date=short --pretty="format:<tr><td>%h</td><td>%ad</td><td>%an</td><td>%s</td></tr>"
Arg 0 is <log>
Arg 1 is <ORIG_HEAD>
Arg 2 is <--no-merges>
Arg 3 is <--date=short>
Arg 4 is <--pretty=format:<tr><td>%h</td><td>%ad</td><td>%an</td><td>%s</td></tr>>
Command line:
"C:\Program Files (x86)\PowerShell Community Extensions\Pscx3\Pscx\Apps\EchoArgs.exe" log ORIG_HEAD --no-merges --date=short --pretty=format:<tr><td>%h</td><td>%ad</td><td>%an</td><td>%s</td></tr>
如果你能看到PowerShell是如何传递对于exe的争论,你有一个战斗机会来弄清楚如何按摩通常涉及使用额外引号的争论。
对不起,这是powershell 2 – Justin808