Ant exec executable =" cmd"用' - '问题

时间:2016-07-19 08:57:59

标签: ant cmd exec

所以我试图在ANT的旧标签中执行一些git命令。

<exec executable="cmd" failonerror="true" dir = "D:\Test">
    <arg value="/c"/>
    <arg value="git remote -v"/>
</exec>

但是我收到了这个错误:  [exec]错误:未知开关`&#39;  [exec]用法:git remote [-v | --verbose]

如果我执行任何其他没有&#39; - &#39;它工作得很好。

1 个答案:

答案 0 :(得分:1)

git命令的每个参数放在其自己的<arg>元素中:

<exec executable="cmd" failonerror="true" dir="D:\Test">
    <arg value="/c"/>
    <arg value="git"/>
    <arg value="remote"/>
    <arg value="-v"/>
</exec>