c# - Get installed applications in a system -


how applications installed in system using c# code?

iterating through registry key "software\microsoft\windows\currentversion\uninstall" seems give comprehensive list of installed applications.

aside example below, can find similar version i've done here.

this rough example, you'll probaby want strip out blank rows in 2nd link provided.

string registry_key = @"software\microsoft\windows\currentversion\uninstall"; using(microsoft.win32.registrykey key = registry.localmachine.opensubkey(registry_key)) {     foreach(string subkey_name in key.getsubkeynames())     {         using(registrykey subkey = key.opensubkey(subkey_name))         {             console.writeline(subkey.getvalue("displayname"));         }     } } 

alternatively, can use wmi has been mentioned:

managementobjectsearcher mos = new managementobjectsearcher("select * win32_product"); foreach(managementobject mo in mos.get()) {     console.writeline(mo["name"]); } 

but rather slower execute, , i've heard may list programs installed under "allusers", though may incorrect. ignores windows components & updates, may handy you.


Comments