我需要计算机上已安装应用程序的列表及其路径目录,我发现:
//Registry path which has information of all the softwares installed on machine
string uninstallKey = @"SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall";
using (RegistryKey rk = Registry.LocalMachine.OpenSubKey(uninstallKey))
{
foreach (string skName in rk.GetSubKeyNames())
{
using (RegistryKey sk = rk.OpenSubKey(skName))
{
// we have many attributes other than these which are useful.
Console.WriteLine(sk.GetValue("DisplayName") +
" " + sk.GetValue("DisplayVersion"));
}
}
}
我如何获得路径?我试过sk.GetValue("DisplayPath")
了,但它不起作用。
谢谢!