现在我使用它来列出注册表中列出的32bit和64的所有应用程序.我已经看到了如何检查应用程序是否安装没有任何运气的其他示例.
string registryKey = @"SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall";
RegistryKey key = Registry.LocalMachine.OpenSubKey(registryKey);
if (key != null)
{
foreach (String a in key.GetSubKeyNames())
{
RegistryKey subkey = key.OpenSubKey(a);
Console.WriteLine(subkey.GetValue("DisplayName"));
}
}
registryKey = @"SOFTWARE\Wow6432Node\Microsoft\Windows\CurrentVersion\Uninstall";
key = Registry.LocalMachine.OpenSubKey(registryKey);
if (key != null)
{
foreach (String a in key.GetSubKeyNames())
{
RegistryKey subkey = key.OpenSubKey(a);
Console.WriteLine(subkey.GetValue("DisplayName"));
}
}
Run Code Online (Sandbox Code Playgroud)
因此,这个片段在控制台窗口中列出了所有内容,我想要做的就是从显示名称列表中找到一个程序标题,看它是否已安装.
我尝试的最后一件事是
if (subkey.Name.Contains("OpenSSL"))
Console.Writeline("OpenSSL Found");
else
Console.Writeline("OpenSSL Not Found");
Run Code Online (Sandbox Code Playgroud)
我试过的任何东西都是假的或假的.有没有人可以告诉我如何从列表中获取一个标题?
请不要发布众所周知的私有静态void IsApplicationInstalled(p_name)函数.它对我来说根本不起作用.
我想使用C#安装应用程序的版本(例如,MyApp).我会做这么多,1.为MyApp版本5.6创建一个"设置"2.安装MyApp.
我将创建另一个应用程序(比如VersionTracker)来获取已安装应用程序的版本.因此,如果我传递名称"MyApp",我希望将版本设为"5.6".如果另一个应用程序说我的系统中安装了Adobe Reader,如果我通过'Adobe Reader',我想获得Adobe Reader的版本.
我需要知道如何构建'VersionTracker'