C# 如何在asp.net c中获取安装在我的系统中的应用程序的路径#
我只想在给定应用程序名称的情况下启动一个应用程序,而不是给定路径——我不知道用户将在何处安装该应用程序。用户可以在任何路径中安装应用程序 例如,如果用户提供像“test.exe”这样的应用程序名,我需要获取路径并启动应用程序(使用process.start) 这是到目前为止我的代码。我目前正在做的是硬编码路径,但我需要帮助找出如何搜索路径C# 如何在asp.net c中获取安装在我的系统中的应用程序的路径#,c#,asp.net,path,directory,registry,C#,Asp.net,Path,Directory,Registry,我只想在给定应用程序名称的情况下启动一个应用程序,而不是给定路径——我不知道用户将在何处安装该应用程序。用户可以在任何路径中安装应用程序 例如,如果用户提供像“test.exe”这样的应用程序名,我需要获取路径并启动应用程序(使用process.start) 这是到目前为止我的代码。我目前正在做的是硬编码路径,但我需要帮助找出如何搜索路径 protected void linkBPD_click(object sender, EventArgs e) { string str = @"C
protected void linkBPD_click(object sender, EventArgs e)
{
string str = @"C:\Program Files\test\testProcess Capture\Common\capture";
if (str != null)
{
Process process3 = new Process();
process3.StartInfo.FileName = str;
process3.Start();
}
else
{
System.Diagnostics.Process process1 = new System.Diagnostics.Process();
// Working directory of .exe file.
process1.StartInfo.WorkingDirectory = Request.MapPath("~/");
// exe file name.
process1.StartInfo.FileName = Request.MapPath("TestCapture.exe");
process1.StartInfo.Arguments = " ";
process1.StartInfo.LoadUserProfile = true;
process1.Start();
}
}
您需要向我们展示您尝试过的代码,否则我们将无能为力。请看一看。我已经添加了代码