Actually, I think you might need to pass those as separate args:
<target name="whatever">
<exec executable="cmd">
<arg value="/c"/>
<arg value="test.bat"/>
</exec>
</target>
Main Topics
Browse All TopicsHi,
I am trying to execute a .BAT file using a simple ANT script.. I have embedded this script in my Cruisecontrol script as below.
<cruisecontrol>
<property name="deploy.bat.path" value="${base.dir}\cbs_hlp
<schedule>
<ant anthome= "C:\ant" target="${deploy.bat.path}
</schedule>
I am hoping that ANT file will execute the BAT file when the Cruisecontrol build happens.. I have ANT installed under C:\ant..
Any ideas?
Thanks
</cruisecontrol>
This Question has been solved and asker verified All Experts Exchange premium technology solutions are available to subscription members.
Experts Exchange has been collecting answers to technology questions since 1996…3 million and counting! If you have a question, chances are we already have your answer.
If you can't find the exact answer you're looking for, ask our exclusive community of 50,000 experts. You’ll get a personalized answer from a trusted professional.
Thousands of free tech tips, tricks, how-to’s and tutorials are available in our peer reviewed articles section. See for yourself how smart our experts are, no login required.
Access the answers to your technology questions today.
30-day free trial. Register in 60 seconds.
Members of the expert community talk about why the experience at Experts Exchange is different than what you will find anywhere else.

Try it out and discover for yourself.
30-day free trial. Register in 60 seconds.
Join the community of experts here and help other tech pros by answering question in your area of expertise. You can earn FREE access to all Experts Exchange's premium features and resources.
Business Accounts
Answer for Membership
by: TimYatesPosted on 2008-10-17 at 06:20:29ID: 22740371
According to the Ant documentation:
html#batch -shell-exe cute
http://ant.apache.org/faq.
-----------------
How do I execute a batch file or shell script from Ant?
On native Unix systems, you should be able to run shell scripts directly. On systems running a Unix-type shell (for example, Cygwin on Windows) execute the (command) shell instead - cmd for batch files, sh for shell scripts - then pass the batch file or shell script (plus any arguments to the script) as a single command, using the /c or -c switch, respectively. See the above section for example <exec> tasks executing sh. For batch files, use something like:
<exec dir="." executable="cmd" os="Windows NT">
<arg line="/c test.bat"/>
</exec>