注册表路径以查找所有已安装的应用程序

时间:2013-05-09 00:42:53

标签: registry installed-applications

我有一个快速的问题: 在注册表中是否还有其他地方,但是:

  

HKEY_LOCAL_MACHINE \ SOFTWARE \微软\的Windows \ CurrentVersion \卸载   HKEY_LOCAL_MACHINE \ SOFTWARE \ Wow6432Node \微软\的Windows \ CurrentVersion \卸载

在哪里可以找到已安装的系统应用程序? 我问的是,因为例如IExplorer不在这些寄存器中。我还能在哪里看?我需要安装应用程序的所有地方。

感谢您的帮助;)

3 个答案:

答案 0 :(得分:5)

您最可靠的选择可能是使用Windows管理界面(WMI)来枚举Windows Installer安装的软件。

见这里
Enumerating Installed Software
Win32_Product class

请注意,这并不能保证Internet Explorer会显示在那里。我认为您可以放心地假设Internet Explorer将出现在当前的每台Windows计算机上; Microsoft将其视为操作系统的一部分。

但是,您可以找到which version of IE is installed

答案 1 :(得分:0)

我一直在寻找这些信息,但是过了一会儿,我想起我已经为它编写了一个程序。 对于每个人,或者对我而言。

class Program
{
    //using Microsoft.Win32;
    //using System.IO;
    static void Main(string[] args)
    {
        string uninstallKey = "Software\\Microsoft\\Windows\\CurrentVersion\\Uninstall";
        RegistryKey regKey = Registry.LocalMachine.OpenSubKey(uninstallKey);
        string[] subKey = regKey.GetSubKeyNames().Select((c)=>
        {
            RegistryKey rk = regKey.OpenSubKey(c);
            string displayName = (string)rk.GetValue("DisplayName");
            if (string.IsNullOrEmpty(displayName)) return "";
            return displayName + string.Format(" => [{0}]", c);
        }).ToArray<string>();
        string filename = "ProgramList.txt";
        if (File.Exists(filename)) File.Delete(filename);
        StreamWriter sw = File.CreateText(filename);
        foreach (string appName in subKey.OrderBy(c=>c))
        {
            if (appName != "" && !appName.StartsWith("{"))
            {
                Console.WriteLine(appName);
                sw.WriteLine(appName);
            }
        }
        sw.Close();
    }
}

答案 2 :(得分:0)

问题中的路径不包括在用户级别安装的应用。

它们位于相同的位置,但位于HKEY_CURRENT_USER下,而不是HKEY_LOCAL_MACHINE下。

总共:

HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall
HKEY_LOCAL_MACHINE\SOFTWARE\Wow6432Node\Microsoft\Windows\CurrentVersion\Uninstall
HKEY_CURRENT_USER\SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall
HKEY_CURRENT_USER\SOFTWARE\Wow6432Node\Microsoft\Windows\CurrentVersion\Uninstall

但是您可以知道,HKEY_CURRENT_USER仅适用于当前用户。

要访问所有用户,请使用HKEY_USERS注册表根,该注册表根为每个用户提供一个文件夹。

因此,您需要:

HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall
HKEY_LOCAL_MACHINE\SOFTWARE\Wow6432Node\Microsoft\Windows\CurrentVersion\Uninstall

for each user sid under HKEY_USERS:
  HKEY_USERS\<user sid>\SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall
  HKEY_USERS\<user sid>\SOFTWARE\Wow6432Node\Microsoft\Windows\CurrentVersion\Uninstall

P.S。如果要在用户的SID及其名称之间进行匹配,则可以在HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows NT\CurrentVersion\ProfileList\<user sid>中查找名为ProfileImagePath的密钥,该密钥应等于C:\Users\<user name>。并非所有用户都具有此键,我认为这些用户是系统用户,或者您不想触摸的东西。