readhardwarekeywmi.vbs
来自「Apress - Managing Enterprise Systems Wit」· VBS 代码 · 共 19 行
VBS
19 行
Const WMICONST = "winmgmts:{impersonationLevel=impersonate}!root\default:"
Const HKEY_CURRENT_USER = &H80000001
Dim objRegistry, nRet, strValue
'create an instance of the StdRegProv registry provider
Set objRegistry = GetObject(WMICONST & "StdRegProv")
'read the value Identifier under key HARDWARE\DESCRIPTION\System
'since the local machine root key is the default, the first parameter is omitted
nRet = objRegistry.GetStringValue(, "HARDWARE\DESCRIPTION\System", _
"Identifier", strValue)
If nRet = 0 Then
Wscript.Echo "The system type is " & strValue
Else
Wscript.Echo "Error reading the HARDWARE\DESCRIPTION\System key"
End If
⌨️ 快捷键说明
复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?