Search code examples
c#wixwix3.6wix-extension

How can I know installation path of a exe?


I'm making a C# program and I need to find installation paths of some software that is installed on a computer. What I have to work with is, I have the Program's name (e.g. Google Chrome), i have the process name (e.g. Chrome.exe). What I need now is the path to Chrome.exe. How can i use C# to find the path if i was to pass either the program name or process name as a parameter for the search? Actually I want to make a custom action which will find chrome.exe and invoke a link. After that I will use the path for search chrome.exe and I want to default open a website via chrome. What should I do..?


Solution

  • Another option to consider is just launching the link using Process.Start() and letting the operating system use the default browser to open the link. That would likely be more what the user would expect.

    In the WiX toolset, you can get that behavior for free using ShellExecute standard custom action from the WixUtilExtension.