Page 1 of 1
%programfiles% on a 64bit system
Posted: 07 Jun 2014 10:15
by highend
Hi,
msg %programfiles%;
shows "C:\Program Files (x86)"
on a 64bit OS (Windows Server 2012 R2).
Which is apparently wrong.
Can you resolve that to the correct folder (C:\Program Files) although XY is only a 32bit application?
And a feature wish as well:
Help file - Advanced topics - Variables
These are the valid environment variables in XYplorer:
%programfiles(x86)%
is missing in the list. One could assume that it's not a valid variable.
Can you add it (if it is)?
Thx,
Highend
Re: %programfiles% on a 64bit system
Posted: 07 Jun 2014 10:17
by admin
Check out this:
%ProgramFiles% = C:\Program Files (x86)
%ProgramFiles(x86)% = C:\Program Files (x86)
%ProgramW6432% = C:\Program Files
Re: %programfiles% on a 64bit system
Posted: 07 Jun 2014 10:50
by highend
Yeah, but the ones you've posted are (partially) wrong.
Correct variable resolving looks like this:
64bit OS:
%ProgramFiles% = C:\Program Files
%ProgramFiles(x86)% = C:\Program Files (x86)
%ProgramW6432% = C:\Program Files
32bit OS:
%ProgramFiles% = C:\Program Files
%ProgramFiles(x86)% = DOES NOT EXIST (by default)
%ProgramW6432% = DOES NOT EXIST (by default)
Re: %programfiles% on a 64bit system
Posted: 07 Jun 2014 10:57
by admin
No, this is by design. %ProgramFiles% is sensitive to the bitness of the calling process:
32-bit process: %ProgramFiles% = C:\Program Files (x86)
64-bit process: %ProgramFiles% = C:\Program Files
It's the way WOW64 is designed. This is not my idea. These variables and their values are owned by Windows.
Re: %programfiles% on a 64bit system
Posted: 07 Jun 2014 11:03
by highend
Ok, I wondered in the first post if it's related to XY beeing only a 32bit app.
Can we have another _internal_ XY var that handles %programfiles% depending on os bitness?

Re: %programfiles% on a 64bit system
Posted: 07 Jun 2014 11:11
by binocular222
highend wrote:Can we have another _internal_ XY var that handles %programfiles% depending on os bitness?

We already have %osbitness%, just do a bit if-else with that variable is ok
Re: %programfiles% on a 64bit system
Posted: 07 Jun 2014 11:18
by highend
I'm using
Code: Select all
$osProgramFiles = (%osbitness% == 64) ? "%ProgramW6432%" : "%Programfiles%";
as a workaround but an internal variable would feel more "native"
Like %osprogramfiles% could automatically resolve to the correct program files dir...
Re: %programfiles% on a 64bit system
Posted: 07 Jun 2014 11:24
by Marco
Maybe I'm still sleepy, but I don't understand exactly what you want to achieve, highend.
Re: %programfiles% on a 64bit system
Posted: 07 Jun 2014 11:46
by binocular222
he means:
%programfile% resolve relative to process's bitness (XY is always x32)
%osprogramfile% resolve relative to OS's bitness