110,533
社区成员
发帖
与我相关
我的任务
分享
using (RegistryKey key = Microsoft.Win32.Registry.LocalMachine.OpenSubKey(@"Software\Microsoft\Windows\CurrentVersion\Uninstall", false))
{
if (key != null)
{
foreach (string keyName in key.GetSubKeyNames())
{
using (RegistryKey key2 = key.OpenSubKey(keyName, false))
{
if (key2 != null)
{
string softwareName = key2.GetValue("DisplayName", "").ToString();
string installLocation = key2.GetValue("InstallLocation", "").ToString();
if (!string.IsNullOrEmpty(installLocation))
{
//this.textBox1.AppendText(string.Format("软件名:{0} -- 安装路径:{1}\r\n", softwareName, installLocation));
listBox1.Items.Add(string.Format("软件名:{0} -- 安装路径:{1}\r\n", softwareName, installLocation));
}
}
}
}
}
}