2009-12-23 46 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