发表评论
用到 WMI 的 Win32_ComputerSystem 类的 SystemType 属性,这里只是提供一个思路,可以灵活的转换为其它语言来使用!
Function X86orX64() On Error Resume Next strComputer = "." Set objWMIService = GetObject("winmgmts:\\" & strComputer & "\root\cimv2") Set colItems = objWMIService.ExecQuery("Select * from Win32_ComputerSystem",,48) For Each objItem in colItems If InStr(objItem.SystemType, "86") <> 0 Then X86orX64 = "x86" ElseIf InStr(objItem.SystemType, "64") <> 0 Then X86orX64 = "x64" Else X86orX64 = objItem.SystemType End If Next End Function WScript.Echo X86orX64()