如何使用Vbscript显示WMI类属性的描述?
我一直在寻找一种以编程方式输出WMI类属性描述的方法,但找不到如何访问修改后的限定符 我已经看到,使用以下代码片段:如何使用Vbscript显示WMI类属性的描述?,vbscript,wmi,Vbscript,Wmi,我一直在寻找一种以编程方式输出WMI类属性描述的方法,但找不到如何访问修改后的限定符 我已经看到,使用以下代码片段: Const wbemFlagUseAmendedQualifiers = &H20000 Set oWMI = GetObject("winmgmts:\\.\root\cimv2") Set oClass = oWMI.Get("Win32_OperatingSystem", wbemFlagUseAmendedQualifiers)
Const wbemFlagUseAmendedQualifiers = &H20000
Set oWMI = GetObject("winmgmts:\\.\root\cimv2")
Set oClass = oWMI.Get("Win32_OperatingSystem", wbemFlagUseAmendedQualifiers)
WScript.Echo oClass.Qualifiers_("Description").Value
下图是我要提取的内容,显示在WMI代码创建者中:
有没有这样的方法可以显示描述
Set oWMI = GetObject("winmgmts:\\.\root\cimv2")
Set oProp = oWMI.Get("Win32_OperatingSystem.BootDevice", wbemFlagUseAmendedQualifiers)
WScript.Echo oProp.Qualifiers_("Description").Value
你快到了。以第一个示例为例,在最后一行中插入
Properties\uuu(“引导设备”)
:
Const wbemFlagUseAmendedQualifiers = &H20000
Set oWMI = GetObject("winmgmts:\\.\root\cimv2")
Set oClass = oWMI.Get("Win32_OperatingSystem", wbemFlagUseAmendedQualifiers)
WScript.Echo oClass.Properties_("BootDevice").Qualifiers_("Description").Value
或者,如果需要遍历所有类属性:
...
On Error Resume Next
For Each oProp in oClass.Properties_
WScript.Echo oProp.Name & ": " & oProp.Qualifiers_("Description").Value
Next
明亮的现在我明白了,这很有道理。非常好,简洁的回答。非常感谢。