本文介绍了从运行ANT一个BAT文件的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我已经经历就很有论坛帖子数走了,但不能梳理出来。我试图运行Ant脚本创建BAT文件。文件夹层次结构是这样的。

   - 工程
| - build.xml文件
| - 构建-C
| | - test.bat的

这是我写的所以对于ANT文件是

 <,项目名称=MyProject的BASEDIR =>
    <属性名=buildC值=$ {basedire} \\打造-C/>    < EXEC DIR =$ {} buildC可执行=CMDOS =Windows XP中>
        < ARG行=/ C test.bat的/>
    < / EXEC>
< /项目>

bat文件内容为

 回声在Build-C TEST.BAT

它说,构建失败..:的I逼债知道错了我是做什么


解决方案

 <属性名=buildC值=$ {basedire} \\打造-C/>

这应该是 $ {BASEDIR} 我猜?使用

 <回声> $ {buildC}< /回声>

以确保目录是正确的。

而不应

 < EXEC DIR =$ {} buildC可执行=test.bat的OS =Windows XP中/>

做的工作?

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 ?

解决方案
<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?

这篇关于从运行ANT一个BAT文件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

08-28 07:23