检测当前的Windows版本是否是32位或64位 [英] Detect whether current Windows version is 32 bit or 64 bit
问题描述
不管你信不信,我安装程序太旧,它并没有一个选项,以检测64位版本的Windows。
Believe it or not, my installer is so old that it doesn't have an option to detect the 64-bit version of Windows.
有一个Windows DLL调用或(甚至更好)的环境变量,这将使该信息的Windows  XP和Windows  Vista的
Is there a Windows DLL call or (even better) an environment variable that would give that information for Windows XP and Windows Vista?
一个可行的办法
我看到维基百科指出,64位版本的Windows&NBSP的; XP和Windows  Vista中有一个独特的环境变量:%ProgramW6432%
,所以我猜这会是空的32位Windows。
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.
该变量指向程序文件
目录,它存储的Windows和其他的所有已安装的程序。在英文系统默认为 C:\ Program Files文件
。在Windows(XP,2003,Vista)的64位版本,也有的%ProgramFiles(x86)的%
默认为 C:\ PROGRAM文件(x86)
和%ProgramW6432%
默认为 C:\ Program Files文件
。该的%ProgramFiles%
本身取决于请求环境变量的过程本身是否是32位或64位(这是由于Windows的在Windows的64位重定向)。
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).
推荐答案
见的的如何检查如果计算机运行的是32位或64位操作系统 的。它还包括从注册表检查这说明:
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:
您可以使用下面的注册表位置来检查,如果计算机运行的是32位或64位Windows操作系统:
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)
上面的x86和0x00000020(32)指示该操作系统的版本是32位
The above "x86" and "0x00000020(32)" indicate that the operating system version is 32 bit.
这篇关于检测当前的Windows版本是否是32位或64位的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!