代码如下
@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:
Environment Variable \ Program Bitness | 32bit Native | 64bit Native | WOW64 |
PROCESSOR_ARCHITECTURE | x86 | AMD64 | x86 |
PROCESSOR_ARCHITEW6432 | undefined | undefined | AMD64 |
原文:http://www.cnblogs.com/libra13179/p/6670946.html