Hi,
Is it possible to run a command (.cmd file) from Ant? Would I need to write Java code for this?
Thanks
Hi,
Is it possible to run a command (.cmd file) from Ant? Would I need to write Java code for this?
Thanks
You can do this by using the exec task. From the ant exec documentation:
Note that .bat files cannot in general by executed directly. One normally needs to execute the command shell executable cmd using the /c switch.
So you would need to do something like:
<exec executable="cmd">
<arg value="/c"/>
<arg value="batchfile.cmd"/>
</exec>
Note that by doing this you have created a dependency of running your ant script in windows.
<exec executable="cmd" os="Windows XP">
<arg value="/C"/>
<arg value="command to run"/>
</exec>