cmd查看电脑是32位还是64位

代码如下

@echo off

if "%PROCESSOR_ARCHITECTURE%" == "AMD64" (
   echo OS is 64bit
) ELSE IF "%PROCESSOR_ARCHITEW6432%" == "AMD64" (
   echo OS is 64bit
) ELSE (
   echo OS is 32bit
)

pause

 知识点:

The general idea is to check the following environment variables:

  • PROCESSOR_ARCHITECTURE – reports the native processor architecture EXCEPT for WOW64, where it reports x86.
  • PROCESSOR_ARCHITEW6432 – not used EXCEPT for WOW64, where it reports the original native processor architecture.
Environment Variable Program Bitness 32bit Native 64bit Native WOW64
PROCESSOR_ARCHITECTURE x86 AMD64 x86
PROCESSOR_ARCHITEW6432 undefined undefined AMD64
原文地址:https://www.cnblogs.com/libra13179/p/6670946.html