检测当前 Windows 版本是 32 位还是 64 位 [英] Detect whether current Windows version is 32 bit or 64 bit

查看:22
本文介绍了检测当前 Windows 版本是 32 位还是 64 位的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

信不信由你,我的安装程序太旧了,它没有检测 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 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.

该变量指向Program Files目录,该目录存放了Windows等所有已安装的程序.英语语言系统的默认值是 C:Program Files.在 64 位版本的 Windows(XP、2003、Vista)中,还有 %ProgramFiles(x86)% 默认为 C:Program Files (x86)%ProgramW6432% 默认为 C:Program Files.%ProgramFiles% 本身取决于请求环境变量的进程本身是 32 位还是 64 位(这是由 Windows-on-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:

HKLMHARDWAREDESCRIPTIONSystemCentralProcessor

您将在右侧窗格中看到以下注册表项:

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屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆