这是我的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
它将提供所有软件名称列表。但我只想要那些在控制面板的程序和功能中可见的软件。
答案 0 :(得分:1)
您可以将shell与KNOWNFOLDERID程序和功能一起使用。
这为您提供了在控制面板上看到的确切列表。
Set Shell = CreateObject("Shell.Application")
Set Programs = Shell.NameSpace("shell:::{7b81be6a-ce2b-4676-a29e-eb907a5126c5}")
For Each item In Programs.Items
WScript.Echo item
Next