在C#中获取已安装程序的exe名称? [英] Getting exe name of installed programs in C#?

查看:426
本文介绍了在C#中获取已安装程序的exe名称?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在使用它来获取程序名称,但是我需要exe名称.我如何找到他们?

i am using this to get the program names, but i need the exe names. How do i find them?

string SoftwareKey = "SOFTWARE\\Microsoft\\Windows\\CurrentVersion\\Installer\\UserData\\S-1-5-18\\Products";
RegistryKey rk = default(RegistryKey);
rk = Registry.LocalMachine.OpenSubKey(SoftwareKey);
//string skname = null;
string sname = string.Empty;

foreach (string skname in rk.GetSubKeyNames())
{

  try
    {
       sname = Registry.LocalMachine.OpenSubKey(SoftwareKey).OpenSubKey(skname).OpenSubKey("InstallProperties").GetValue("DisplayName").ToString();
       listBox1.Items.Add(sname);
     }
     catch (Exception ex)
     {
        MessageBox.Show(ex.Message);
     }
}

我正在尝试这样做:

System.Diagnostics.Process.Start("Name.exe");

运行程序.

推荐答案

安装程序实际上并不知道实际的可执行文件.它只知道安装包-.MSI文件.

The installer doesn't, and really couldn't, know about the actuall executables. It only knows about the installation package - the .MSI file.

为了获取可执行文件的名称(是的,许多程序"由许多.EXE文件组成),您需要查询.MSI文件.

In order to get the names of the executables (yes, many "programs" are composed of numerous .EXE files) you would need to interrogate the .MSI file.

这篇关于在C#中获取已安装程序的exe名称?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆