【发布时间】:2021-11-02 19:12:06
【问题描述】:
这是我的 VBS 代码:
Const HKEY_LOCAL_MACHINE = &H80000002
Dim strComputer, strKeyPath
Dim objReg, strSubkey, arrSubkeys
Dim Name, Version
strComputer = "."
' Registry key path of Control panel items for installed programs
strKeyPath = "SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\"
Set objReg=GetObject("winmgmts:{impersonationLevel=impersonate}!\\" & _
strComputer & "\root\default:StdRegProv")
objReg.EnumKey HKEY_LOCAL_MACHINE, strKeyPath, arrSubkeys
'Enumerate registry keys.
For Each strSubkey In arrSubkeys
objReg.GetStringValue HKEY_LOCAL_MACHINE, strKeyPath & strSubkey, "DisplayName" , Name
If Name <> "" Then
WScript.Echo Name&""&","
End If
Next
WScript.Echo "Installed Programs listed successfully through Registry using VBScript."
WScript.Quit
它将给出所有软件名称列表。但我只想要那些在控制面板的程序和功能中可见的软件。
【问题讨论】:
标签: vbscript