Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to get environment variable ProgramFiles(x86) in Ant

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

like image 463
Jerry Avatar asked Nov 19 '12 15:11

Jerry


2 Answers

Use ${env.ProgramFiles(x86)}. The variable is case-sensitive in a way that is inconsistent 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
like image 193
Jerry Avatar answered Nov 18 '22 17:11

Jerry


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

Apologies, I don't have a windows machine to test this one.

If this doesn't work I'd suggest adding the following property task in your build:

<property environment="env"/>

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

 ant -d 
like image 2
Mark O'Connor Avatar answered Nov 18 '22 19:11

Mark O'Connor