Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
HomeAnnouncementsWhite Papers
Discussion GroupsFirst AidDatabasesJavaBeansGUIJava 3DVirtual MachineCORBASecurityToolsGeneral
Java DirectoryOpen Source ProjectsSample Book ChaptersUser GroupsWeb Resources
Related Topics
Databases.NETMore Topics ...

Java Forum / Tools / October 2005

Tip: Looking for answers? Try searching our database.

Run BAT from ANT

Thread view: 
ive_got_a_diploma@yahoo.com - 07 Oct 2005 02:50 GMT
Does anyone know of a jar and task that lets you run
BAT as an ANT task?

When I try these commands with the properties correctly defined,
the bat application starts up and immediately shuts down
without doing any work. (Any suggestions?)

I'm running WinXP.

Thanks.

<target name="do-release">
<exec dir="W:\nk\bbat\run_common"executable="cmd.exe">
    <arg value="bat.bat"/>
    <arg value="-d"/>
    <arg value="build"/>
    <arg value="../../bcf_common/pz/bcf.xml"/>
    <arg value="${application-name}-label-${pvcs-labe}"/>
    </exec>
</target>

<target name="t">
    <exec dir="W:\nk\bbat\run_common" os="Windows XP"
    executable="cmd.exe" spawn="true">
    <arg value="bat.bat"/>
    <arg value="-d"/>
    <arg value="../../bcf_common/pz/bcf.xml"/>
    <arg value="${application-name}-label-${pvcs-label}"/>
    </exec>
</target>
Roedy Green - 07 Oct 2005 05:42 GMT
>Does anyone know of a jar and task that lets you run
>BAT as an ANT task?

<exec executable="xxxx.exe" dir="${package.dir}">


Your executable is called something like cmd.exe or 4NT.exe. Your bat
file is a parameter to it.

See http://mindprod.com/jgloss/exec.html

What you want to do is use Java's exec to spawn a command processor
within ANT.
Signature

Canadian Mind Products, Roedy Green.
http://mindprod.com Again taking new Java programming contracts.

Roedy Green - 07 Oct 2005 05:44 GMT
><exec dir="W:\nk\bbat\run_common"executable="cmd.exe">
>    <arg value="bat.bat"/>
[quoted text clipped - 4 lines]
>    </exec>
></target>

Looks like you are missing a space before executable.

Do something must simpler to start then gradually add the complexity.
e.g. bat file just says pause "it worked"

Signature

Canadian Mind Products, Roedy Green.
http://mindprod.com Again taking new Java programming contracts.

Roedy Green - 07 Oct 2005 05:45 GMT
><exec dir="W:\nk\bbat\run_common"

in Ant-land you use platform independent filenames. So get rid of the
W:   Everything is relative.  and change the \ to /
.
Signature

Canadian Mind Products, Roedy Green.
http://mindprod.com Again taking new Java programming contracts.



Free Magazines

Get these publications absolutely FREE for up to 12 months. There are no hidden fees and no obligation. Simply choose a title, complete the application form and submit it. Read more ...

Oracle MagazineNetwork ComputingComputer WorldBio-IT WorldeWeekInformation WeekInfosecurity
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.