These lines of code can display installed sotwares in your computer.
Introduction
This Article is useful for getting list of installed softwares in your local system.
It will show programs path where it is install.
Following following steps
1.Take one windows application
2.Add one windows form
2.In form1.cs
Write following codes
using
Microsoft.Win32;
private
void Form1_Load(object sender, EventArgs e)
{
MessageBox.Show(Getinstalledsoftware());
}
private
string Getinstalledsoftware()
{
//Declare the string to hold the list:
string Software = null;
//The registry key:
string SoftwareKey = @"SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall";
using (RegistryKey rk = Registry.LocalMachine.OpenSubKey(SoftwareKey))
{
//Let's go through the registry keys and get the info we need:
foreach (string skName in rk.GetSubKeyNames())
{
using (RegistryKey sk = rk.OpenSubKey(skName))
{
try
{
//If the key has value, continue, if not, skip it:
if (!(sk.GetValue("DisplayName") == null))
{
//Is the install location known?
if (sk.GetValue("InstallLocation") == null)
Software += sk.GetValue(
"DisplayName") + " - Install path not known\n"; //Nope, not here.
else
Software += sk.GetValue(
"DisplayName") + " - " + sk.GetValue("InstallLocation") + "\n"; //Yes, here it is...
}
}
catch (Exception ex)
{
//No, that exception is not getting away... :P
}
}
}
}
return Software;
}
Conclusion
Run the page and see the magic.