2009-12-23 22 views
0

这是在Windows XP环境。

我试图安装和编辑的一些文件有默认设置。我想更新这些设置使用来自$项目{ENV}

+0

你为什么想要?请更多的背景。 Ant不是一种脚本语言。 – duffymo 2009-12-23 19:34:15

回答

3

使用foreachant-contrib,你可以遍历${env},如:

<target name="run"> 
    <foreach item="String" in="${env.CLASSPATH}" delim=";" property="x"> 
     <echo message="${x}" /> 
    </foreach> 
</target> 

我能够与恶性做到这一点:

<target name="run"> 
    <foreach item="String" in="${environment::get-variable('CLASSPATH')}" delim=";" property="x"> 
     <echo message="${x}" /> 
    </foreach> 
</target> 
+0

蚂蚁的contrib工作太=]关于得到每个$ 什么{ENV。*}? – qodeninja 2009-12-23 20:06:38

+1

'echoproperties'可能是你在找什么。 http://ant.apache.org/manual/OptionalTask​​s/echoproperties.html – 2009-12-23 20:20:46