How to get ProgramFiles (x86) environment variable in Ant

I can get %ProgramFiles% in Ant using ${env.PROGRAMFILES} . But I can not figure out how to get %ProgramFiles(x86)% .

+6
source share
2 answers

Use ${env.ProgramFiles(x86)} . The variable is case sensitive in a way that is incompatible with env.PROGRAMFILES.

 [echo] env.ProgramFiles(x86) == C:\Program Files (x86) [echo] env.PROGRAMFILES(x86) == ${env.PROGRAMFILES(x86)} [echo] env.ProgramFiles == ${env.ProgramFiles} [echo] env.PROGRAMFILES == C:\Program Files 
+7
source

Have you tried ${env.PROGRAMFILES(x86)} ? (See how to get x86 env variable program files? )

Sorry, I do not have a Windows machine to test this.

If this does not work, I would suggest adding the following constructive task to your assembly:

 <property environment="env"/> 

And run ANT in debug mode to see the set values:

  ant -d 
+2
source

All Articles