0

Does anyone know how to determine the absolute path of an installed application using C#? I tried the following method found here, but it did not work as it did not contain any path information.

I have been struggling with this for a while now and am hoping someone out there can help me out.

mrtedweb
  • 783
  • 2
  • 9
  • 18
  • 1
    http://stackoverflow.com/questions/3916713/how-can-i-get-another-applications-installation-path-programmatically – mclaassen Jul 03 '14 at 19:01
  • 1
    There is no generic way to answer this question. It entirely depends on the application and the way it was installed. – O. R. Mapper Jul 03 '14 at 19:06
  • You could ask the user? – Patrick Jul 03 '14 at 19:32
  • You could also search the hard drive for the .exe file. If you know the name of the file. It's an expensive way to do things and it's possible it won't be 100% effective, but it will work in many cases. – Jim Mischel Jul 03 '14 at 19:39
  • What about reading the properties of the application's shortcut from the start menu? Is 'C:\ProgramData\Microsoft\Windows\Start Menu\Programs\...' a reliable place to look for all start menu shortcuts, or can this vary depending upon setup, OS version etc? – mrtedweb Jul 03 '14 at 19:51
  • assuming it's on the start menu . . . – Jim Mischel Jul 04 '14 at 20:27
  • Here's what I found: Step 1) Search registry for application's Product Key. Registry.ClassesRoot.OpenSubKey(@"Installer\Products").GetSubKeyNames(); Cycle through and find the subkey containing the "ProductName" key value matching what you are looking. The name of the subkey will be the product key (e.g. "F6E7BA2742CBE184C854A15B3BDD97D5"). Step 2) Search registry for the following subkey: RegistryKey.LocalMachine.OpenSubKey(@"SOFTWARE\Microsoft\Windows\CurrentVersion\Installer\UserData\S-1-5-18\Components\F6E7BA2742CBE184C854A15B3BDD97D5"); This will contain the path to the executable. – mrtedweb Jul 08 '14 at 01:03

0 Answers0