Oli*_*ver 13
看一下注册表
HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall
Run Code Online (Sandbox Code Playgroud)
只需迭代所有子键,然后查看值DisplayName和InstallLocation.在这里你可以找到你想要的信息以及更多;-)
为了增加Oliver的答案,我在静态方法中包含了这个检查.
public static bool IsProgramInstalled(string programDisplayName) {
Console.WriteLine(string.Format("Checking install status of: {0}", programDisplayName));
foreach (var item in Registry.LocalMachine.OpenSubKey("SOFTWARE\\Microsoft\\Windows\\CurrentVersion\\Uninstall").GetSubKeyNames()) {
object programName = Registry.LocalMachine.OpenSubKey("SOFTWARE\\Microsoft\\Windows\\CurrentVersion\\Uninstall\\" + item).GetValue("DisplayName");
Console.WriteLine(programName);
if (string.Equals(programName, programDisplayName)) {
Console.WriteLine("Install status: INSTALLED");
return true;
}
}
Console.WriteLine("Install status: NOT INSTALLED");
return false;
}
Run Code Online (Sandbox Code Playgroud)