Problem evaluating "Program Files" environment variable on WinXP x64

(imported topic written by SystemAdmin)


Strange one this. I’m trying to evaluate the local environment variable called “ProgramFiles” on an x64 machine.

The relevance is easy:

value of variable “ProgramFiles” of environment

However, it returns “C:\Program Files (x86)”. The actual environment variable returns “C:\Program Files” when queried from the command line.

What’s the way to get the ‘true’ environment variable value?


(imported comment written by arnaud91)

Hi Adam,

Try this:

Q: value of variable “ProgramW6432” of environment

A: C:\Program Files

Some explanations here:

Basically, if you run cmd.exe on a 64bit machine, it runs as a 64bit process, so %programfiles% is set to “C:\Program Files”

But the BigFix Client (or the Relevance Debugger if you use it) runs as 32bit process, so %programfiles% is set to “C:\Program Files (x86)”