Solved

Executing a BAT file using ANT

Posted on 2008-10-13
7
6,823 Views
Last Modified: 2013-11-13
Hi,

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\deploy.bat"/>

 <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>
0
Comment
Question by:pdurbha
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 2
7 Comments
 
LVL 35

Accepted Solution

by:
TimYates earned 250 total points
ID: 22740371
According to the Ant documentation:

http://ant.apache.org/faq.html#batch-shell-execute

-----------------

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>
0
 

Assisted Solution

by:sstair
sstair earned 250 total points
ID: 22887372
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>
0
 
LVL 35

Expert Comment

by:TimYates
ID: 23097607
I feel this should be a split between me and sstair, as he is right that you have to separate out the params :)
0

Featured Post

Forrester Webinar: xMatters Delivers 261% ROI

Guest speaker Dean Davison, Forrester Principal Consultant, explains how a Fortune 500 communication company using xMatters found these results: Achieved a 261% ROI, Experienced $753,280 in net present value benefits over 3 years and Reduced MTTR by 91% for tier 1 incidents.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
Visual Studio hangs on running project 6 62
Do Wend Macro not working 22 58
Review of the nodejs code 1 37
How to delete text box content on subform 1 20
Entering a date in Microsoft Access can be tricky. A typo can cause month and day to be shuffled, entering the day only causes an error, as does entering, say, day 31 in June. This article shows how an inputmask supported by code can help the user a…
In threads here at EE, each comment has a unique Identifier (ID). It is easy to get the full path for an ID via the right-click context menu. However, we often want to post a short link within a thread rather than the full link. This article shows a…
The viewer will learn how to create and use a small PHP class to apply a watermark to an image. This video shows the viewer the setup for the PHP watermark as well as important coding language. Continue to Part 2 to learn the core code used in creat…

726 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question