%ProgramFiles%

Things you’d like to miss in the future...
Post Reply
oblivion
Posts: 142
Joined: 13 Apr 2011 11:35

%ProgramFiles%

Post by oblivion »

I've been trying to diagnose and fix some weird behaviour on a couple of my systems. In my investigations, I discovered that the %ProgramFiles% environment variable was set to \Program Files (x86) instead of what it should be.

So a bit more digging and general paranoia later, I think it's XYplorer misreporting it rather than it actually being wrong.

So my most recent experiment: reboot, open a command prompt, type set and look to see if it's wrong. It isn't.

Start XYPlorer, open a command prompt, type set and look again. Still correct.

Then look at the environment variables list produced from XYPlorer's Help menu. There, it's wrong.

Double-check from a command prompt: still okay.

Now: I thought (but can't currently verify) that I'd checked from a command prompt at some point previously and found it wrong.

So I guess the question is: is XYPlorer reporting something correctly that's otherwise being masked, or is it getting it wrong and under some circumstance (possibly as a result of running something from XYPlorer) actually setting the variable? Or is it just getting it wrong for some reason and causing me to be unnecessarily paranoid? ;)

(Windows 10 and Windows 7, 64-bit (obviously!) and XY 19.30
-- bests, Tim

...This space unintentionally left blank.

admin
Site Admin
Posts: 60357
Joined: 22 May 2004 16:48
Location: Win8.1 @100%, Win10 @100%
Contact:

Re: %ProgramFiles%

Post by admin »

If you are looking for a variable that always points to the 64-bit programs folder (usually C:\Program Files) independently of the bitness of the hosting process it's %ProgramW6432%.

oblivion
Posts: 142
Joined: 13 Apr 2011 11:35

Re: %ProgramFiles%

Post by oblivion »

No, I'm not trying to find a variable, I'm trying to work out why something entirely unrelated to XYplorer broke -- but which I might well have installed from an XYplorer window. It might not be an XYplorer issue at all -- but I'm concerned that XYplorer, in reporting the %ProgramFiles% variable incorrectly, might also create an environment with that variable incorrectly set when (for instance) a program is run from an XYplorer window. Might an installer, for instance, read the %ProgramFiles% variable when it assesses the appropriate place to install itself, and might it have been given that information by XYplorer?
-- bests, Tim

...This space unintentionally left blank.

admin
Site Admin
Posts: 60357
Joined: 22 May 2004 16:48
Location: Win8.1 @100%, Win10 @100%
Contact:

Re: %ProgramFiles%

Post by admin »

Nothing to do with XYplorer. These variables are resolved by Windows, and some of them take the bitness of their process into account.

Code: Select all

                      32-bit process              64-bit process

%ProgramFiles%        C:\Program Files (x86)      C:\Program Files
%ProgramFiles(x86)%   C:\Program Files (x86)      C:\Program Files (x86)
%ProgramW6432%        C:\Program Files            C:\Program Files

oblivion
Posts: 142
Joined: 13 Apr 2011 11:35

Re: %ProgramFiles%

Post by oblivion »

Ah -- I think I understand. So you're saying that it's not that XYplorer is misreporting %ProgramFiles%, it's providing the answer that Windows gives when a 32-bit process queries the variable?

I'm not used to the concept of an environment variable that's context-sensitive :)

Thanks for the clarification. Sounds like I'm barking up the wrong tree in my attempts to work out what went wrong...
-- bests, Tim

...This space unintentionally left blank.

Post Reply