When I say "installed application", I basically mean any application visible in [Control Panel]->[Add/Remove Programs].
I would prefer to do it in Python, but C or C++ is also fine.
When I say "installed application", I basically mean any application visible in [Control Panel]->[Add/Remove Programs].
I would prefer to do it in Python, but C or C++ is also fine.
Check out the Win32_Product WMI (Windows Management Instrumentation) class. Here's a tutorial on using WMI in Python.
If you mean the list of installed applications that is shown in Add\Remove Programs in the control panel, you can find it in the registry key:
HKEY_LOCAL_MACHINE\Software\Microsoft\Windows\CurrentVersion\Uninstall
more info about how the registry tree is structured can be found here.
You need to use the winreg API in python to read the values from the registry.
Control Panel uses Win32 COM api, which is the official method (see Google Groups, Win32)
Never rely on registry.
The Microsoft Script Repository has a script for listing all installed software.
import win32com.client
strComputer = "."
objWMIService = win32com.client.Dispatch("WbemScripting.SWbemLocator")
objSWbemServices = objWMIService.ConnectServer(strComputer,"root\cimv2")
colItems = objSWbemServices.ExecQuery("Select * from Win32_Product")
for objItem in colItems:
print "Caption: ", objItem.Caption
print "Description: ", objItem.Description
print "Identifying Number: ", objItem.IdentifyingNumber
print "Install Date: ", objItem.InstallDate
print "Install Date 2: ", objItem.InstallDate2
print "Install Location: ", objItem.InstallLocation
print "Install State: ", objItem.InstallState
print "Name: ", objItem.Name
print "Package Cache: ", objItem.PackageCache
print "SKU Number: ", objItem.SKUNumber
print "Vendor: ", objItem.Vendor
print "Version: ", objItem.Version
C#.net code for getting the list of installed software using WMI in xp and win7(wmi is the only way in win7)
WqlObjectQuery wqlQuery =
new WqlObjectQuery("SELECT * FROM Win32_Product");
ManagementObjectSearcher searcher =
new ManagementObjectSearcher(wqlQuery);
foreach (ManagementObject software in searcher.Get()) {
Console.WriteLine(software["Caption"]);
}