我可以使用 %tmp% 在批处理文件中获取用户临时目录。如何在ant中获取用户临时目录?
问问题
3762 次
2 回答
5
作为上一个答案的后续,您可以访问用户的环境变量并使用 TMP 或 TEMP 中的值:
<project name="test" default="showtemp">
<property environment="env"/>
<target name="showtemp">
<echo message="TMP=${env.TMP}"/>
</target>
</project>
也许更好的方法是使用 java 系统属性java.io.tmpdir
<project name="test" default="showtemp">
<target name="showtemp">
<echo message="java.io.tmpdir=${java.io.tmpdir}"/>
</target>
</project>
于 2014-01-15T00:32:51.370 回答
2
The tempfile task can be used to create temporary files and directories.
Don't forget ANT is a Java program to access to the windows temporary directory would be platform specific. You could try access it using the environment variables:
<propety environment="env"/>
<echo message="windows tmpdir=${env.tmp}"/>
于 2013-09-21T10:32:11.330 回答