How to determine OS Platform with WMI?

后端 未结 13 3571
無奈伤痛
無奈伤痛 2021-02-20 03:46

I am trying to figure out if there is a location in WMI that will return the OS Architecture (i.e. 32-bit or 64-bit) that will work across \"all\" versions of Windows. I though

13条回答
  •  栀梦
    栀梦 (楼主)
    2021-02-20 04:29

    In VBS:

    On Error Resume Next
    
    Const wbemFlagReturnImmediately = &h10
    Const wbemFlagForwardOnly = &h20
    
    Set objWMIService = GetObject("winmgmts:\\.\root\CIMV2")
    Set colItems = objWMIService.ExecQuery("SELECT * FROM Win32_Processor", "WQL", _
                                              wbemFlagReturnImmediately + wbemFlagForwardOnly)
    For Each objItem In colItems
       WScript.Echo "AddressWidth: " & objItem.AddressWidth
    Next
    

提交回复
热议问题