c# 通过注册表判断有没有安装某个软件
private bool checkHasInstalledSoftWare(string displayName)
{
Microsoft.Win32.RegistryKey uninstallNode = Microsoft.Win32.Registry.LocalMachine.OpenSubKey(@"SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall");
foreach (string subKeyName in uninstallNode.GetSubKeyNames())
{
Microsoft.Win32.RegistryKey subKey = uninstallNode.OpenSubKey(subKeyName);
object disName = subKey.GetValue("DisplayName");
if (disName != null)
{
if (disName.ToString()== displayName)
{
return true;
// MessageBox.Show(displayName.ToString());
Debug.Print(""+displayName);//Microsoft Edge
}
}
}
return false;
}
调用:
if (checkHasInstalledSoftWare("Microsoft Edge"))
{
//.......
}
else {
//-----------
}
fffffffffffffffff
test red font.

浙公网安备 33010602011771号