What is the “correct” way for a 32-bit application to find the “Program Files” folder on 64-bit Windows? For example, I am running a 32-bit application with the VBScript engine and want to run 64-bit Excel (using ShellExec or similar). In a 32-bit world, I would check the "ProgramFiles" environment variable to get the base folder. I understand that as a 32-bit application on 64-bit Windows, this environment variable will point to the 32-bit program files folder - for example: C: \ Program Files (x86). But my 64-bit Excel will be under C: \ Program Files.
I want to avoid hard-coding a link to "c: \ program files".
source share