Believe it or not, my installer is so old that it doesn't have an option to detect the 64-bit version of Windows.
Is there a Windows DLL call or (even better) an environment variable that would give that information for Windows XP and Windows Vista?
One possible solution
I see that Wikipedia states that the 64-bit version of Windows XP and Windows Vista have a unique environment variable: %ProgramW6432%
, so I'm guessing that'd be empty on 32-bit Windows.
This variable points to Program Files
directory, which stores all the installed program of Windows and others. The default on English-language systems is C:\Program Files
. In 64-bit editions of Windows (XP, 2003, Vista), there are also %ProgramFiles(x86)%
which defaults to C:\Program Files (x86)
and %ProgramW6432%
which defaults to C:\Program Files
. The %ProgramFiles%
itself depends on whether the process requesting the environment variable is itself 32-bit or 64-bit (this is caused by Windows-on-Windows 64-bit redirection).
See the batch script listed in How To Check If Computer Is Running A 32 Bit or 64 Bit Operating System. It also includes instructions for checking this from the Registry:
You can use the following registry location to check if computer is running 32 or 64 bit of Windows operating system:
HKLM\HARDWARE\DESCRIPTION\System\CentralProcessor\0
You will see the following registry entries in the right pane:
Identifier REG_SZ x86 Family 6 Model 14 Stepping 12
Platform ID REG_DWORD 0x00000020(32)
The above “x86” and “0x00000020(32)” indicate that the operating system version is 32 bit.