Detect whether current Windows version is 32 bit or 64 bit

前端 未结 23 2846
抹茶落季
抹茶落季 2020-11-28 03:47

Believe it or not, my installer is so old that it doesn\'t have an option to detect the 64-bit version of Windows.

Is there a Windows DLL call or (even better) an en

23条回答
  •  心在旅途
    2020-11-28 04:34

    Using Windows Powershell, if the following expression returns true, then it's a 64 bit OS:

    (([Array](Get-WmiObject -Class Win32_Processor | Select-Object AddressWidth))[0].AddressWidth -eq 64)

    This was taken and modified from: http://depsharee.blogspot.com/2011/06/how-do-detect-operating-system.html (Method #3). I've tested this on Win7 64 bit (in both 32 and 64 bit PowerShell sessions), and XP 32 bit.

提交回复
热议问题