0

I want to launch an application given only the application name, and not the path -- I don't know where exactly the user would have installed the application. The user can install an application in any path.

For example, if the user provides an application name like 'test.exe', I need to get the path and launch the application (using process.start).

Here is my code so far. What I'm currently doing is hard-coding the path, but I need help figuring out how to search for it instead.

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(); } } 
2
  • You need to show us the code that you tried, or else we cannot help. Please see stackoverflow.com/help/how-to-ask Commented Dec 28, 2016 at 10:21
  • Have a look. I have added the code Commented Dec 28, 2016 at 11:08

0

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.