/// <summary>
/// 判断windows是否装有某软件
/// </summary>
/// <param name="softWareName">软件名</param>
/// <returns></returns>
public bool SoftWareIsExist(string softWareName) {
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 displayName = subKey.GetValue("DisplayName");
if (displayName != null)
{
if (displayName.ToString().ToUpper().Contains(softWareName.ToUpper())) return true;
}
}
return false;
}