110,533
社区成员
发帖
与我相关
我的任务
分享
public static void DisplayInstalledApps(RegistryKey key)
{
string displayName;
if (key != null)
{
foreach (String keyName in key.GetSubKeyNames())
{
RegistryKey subkey = key.OpenSubKey(keyName);
displayName = subkey.GetValue("DisplayName") as string;
if (!string.IsNullOrEmpty(displayName))
{
Console.WriteLine(displayName);
}
}
}
}
public static void ShowAllSoftwaresName()
{
RegistryKey key;
// search in: CurrentUser
key = Registry.CurrentUser.OpenSubKey(@"SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall");
DisplayInstalledApps(key);
// search in: LocalMachine_32
key = Registry.LocalMachine.OpenSubKey(@"SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall");
DisplayInstalledApps(key);
// search in: CurrentUser_64
key = Registry.CurrentUser.OpenSubKey(@"SOFTWARE\Wow6432Node\Microsoft\Windows\CurrentVersion\Uninstall");
DisplayInstalledApps(key);
// search in: LocalMachine_64
key = Registry.LocalMachine.OpenSubKey(@"SOFTWARE\Wow6432Node\Microsoft\Windows\CurrentVersion\Uninstall");
DisplayInstalledApps(key);
}