Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Running a BAT file from ANT

I have gone through number of posts on the very forum but couldn't sort it out. I am trying to run a BAT file from ANT script. The folder hierarchy is like this

- Project
| - build.xml
| - build-C
| | - test.bat

The ANT file that i wrote so for is

<project name="MyProject" basedir=".">
    <property name="buildC" value="${basedire}\build-C" />

    <exec dir="${buildC}" executable="cmd" os="Windows XP">
        <arg line="/c test.bat"/>
    </exec>
</project>

The bat file content is

echo In Build-C Test.bat

It says that build failed .. :s i dun know what wrong am i doing ?

like image 415
x.509 Avatar asked Jul 07 '11 19:07

x.509


People also ask

Can you run a bat file on Ubuntu?

First, Ubuntu runs shell scripts, not batch files, so your file must have a . sh extension. Secondly, Ubuntu forbids users to run any scripts on a file unless it has execute permissions.

How do I run a .bat file from HTML?

Just create a batch file and save in the location where your html file is there. this anchor tag will execute the (test. bat) batch file. After clicking on the link <TEST>, you will get the window prompting to open/save/close, if you will click on open then batch file will be executed.


1 Answers

<property name="buildC" value="${basedire}\build-C" />

This should be ${basedir} I guess? Use

<echo>${buildC}</echo>

to make sure the dir is correct.

And shouldn't

<exec dir="${buildC}" executable="test.bat" os="Windows XP" />

do the job?

like image 150
wonk0 Avatar answered Sep 24 '22 01:09

wonk0