首页 > 解决方案 > 获取windows中已安装应用程序的列表

问题描述

我找到了从这里获取已安装程序列表的解决方案。获取系统中已安装的应用程序

但没有得到所有已安装的程序,缺少列表中的一些程序。如何在不跳过的情况下获取所有节目列表

这是我的代码..

        try
        {
            object line;
            string softwareinstallpath = string.Empty;
            string registry_key = @"SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall";
            using (var baseKey =RegistryKey.OpenBaseKey(RegistryHive.LocalMachine, RegistryView.Registry64))
            {
                using (var key = baseKey.OpenSubKey(registry_key))
                {
                    foreach (string subkey_name in key.GetSubKeyNames())
                    {
                        using (var subKey = key.OpenSubKey(subkey_name))
                        {
                            line = subKey.GetValue("DisplayName");
                            if (line != null)
                            {
                                listBox1.Items.Add(line);

                                if (line != null && (line.ToString().ToUpper().Contains("SKYPE")))
                                {
                                    MessageBox.Show("SKYPE");
                                }
                                if (line != null && (line.ToString().ToUpper().Contains("QBFC")))
                                {
                                    softwareinstallpath = subKey.GetValue("InstallLocation").ToString();
                                    listBox1.Items.Add(subKey.GetValue("InstallLocation"));
                                    break;
                                }
                            }
                        }
                    }
                }
            }

        }
        catch (Exception ex)
        {
            MessageBox.Show(ex.Message + Environment.NewLine + ex.StackTrace);
        }

标签: c#

解决方案


推荐阅读