In C # .NET 2.0 or higher, how to get a list of all installed applications on Vista PC
Using C # .NET 2.0 or later and Visual Studio 2008, how to create a list of all installed applications on Windows Vista PC?
My motivation is to get a text file of all my installed applications that I can save and maintain, so that when I restore my machine, I have a list of all my old applications.
The second part of this question is the SuperUser.com thing, but hopefully the first part counts as "programming".
thank
source to share
You can find a link to the SOFTWARE \ Microsoft \ Windows \ CurrentVersion \ Uninstall registry key. Check out these links:
http://www.onedotnetway.com/get-a-list-of-installed-applications-using-linq-and-c/ http://social.msdn.microsoft.com/forums/en-US/netfxbcl/ thread / ac23690a-f5f8-46fc-9047-c369f4370fac
source to share
As a result, you will get installed applications for all users. Do the same for Registry.CurrentUser:
RegistryKey uninstall = Registry.LocalMachine.OpenSubKey(@"SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall");
List<string> applicationList = new List<string>();
foreach (string subKeyName in uninstall.GetSubKeyNames())
{
RegistryKey subKey = uninstall.OpenSubKey(subKeyName);
string applicationName = subKey.GetValue("DisplayName", String.Empty).ToString();
if (!String.IsNullOrEmpty(applicationName))
{
applicationList.Add(applicationName);
}
subKey.Close();
}
uninstall.Close();
applicationList.Sort();
foreach (string name in applicationList)
{
Console.WriteLine(name);
}
DISCLAIMER: There is no null value / error checking in my example!
source to share
See the source code of this library
foreach(var info in BlackFox.Win32.UninstallInformations.Informations.GetInformations())
{
Console.WriteLine(info.ToString());
}
source to share