I am trying to execute cmd.exe /C echo Please write this to a file >> output.txt using ant <exec> task. This command works fine when executed from command line. But does not work when executed using ant. Here is what I am trying to do.
<exec executable="${env.ComSpec}" osfamily="windows">
<arg value="/C"/>
<arg value="echo"/>
<arg value="Please write this to file"/>
<arg value=">>"/>
<arg value="output.txt"/>
</exec>
Can somebody tell me where I am going wrong?
Thanks in advance for your inputs.
The
>>is not an argument tocmd.exeyou are about to execute, but to the current shellTry the
outputparameter of the exec ant task