批量检测系统是 32 位还是 64 位 [英] Batch to detect if system is a 32-bit or 64-bit
本文介绍了批量检测系统是 32 位还是 64 位的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
有谁知道如何创建一个批处理文件,如果它是 64 位系统,它可以对一个程序进行 shell,如果是 32 位系统,则可以对另一个程序进行 shell?
Does anybody know how to create a batch file that can shell one program if its a 64-bit system or shell another if its a 32-bit system?
推荐答案
检查 %PROCESSOR_ARCHITECTURE%
是否为 x86
:
if %PROCESSOR_ARCHITECTURE%==x86 (
rem 32 bit
) else (
rem 64 bit
)
至少目前是这样.例如,在服务器上,我可以访问它的 AMD64
但不知道 Itanium 的样子.但是 32 位版本总是报告 x86
.
At least for the time being. On a server I have access to it's AMD64
but no clue how Itanium looks like, for example. But 32-bit versions always report x86
.
另一个选项,也适用于 WoW64:
Another option, that also works on WoW64:
for /f "skip=1 delims=" %%x in ('wmic cpu get addresswidth') do if not defined AddressWidth set AddressWidth=%%x
if %AddressWidth%==64 (
rem 64 bit
) else (
rem 32 bit
)
这篇关于批量检测系统是 32 位还是 64 位的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文