0

Is there any clear code to find an application installation path by EXE name?

I found this but it is usefulness at all.

Thank you!

3
  • No, of course not. Not all applications write their installation path in the registry, and the ones that do will always use different path/key names. The only way you could be sure would be to search the hard drive for the exe name. Commented Jul 13, 2012 at 14:15
  • @FrankWhite But if i know exactly that some of apps are installed. How I can do it? Commented Jul 13, 2012 at 14:17
  • 1
    The obvious way - if you are looking for set specific applications - is to do a regedit search for the exe after installing it. Then you can just check the same Reg Address in your code for other machines. This is not absolutely safe either though as versions of the app may use the reg differently (or not at all) and users may install differently (just me or all users etc) which could affect it. Commented Jul 13, 2012 at 15:17

1 Answer 1

1

If you know the registry path to the value that you want to read in you could do:

var key = Registry.LocalMachine.OpenSupKey("SOFTWARE\MyCompany\Data"); var value = key.GetValue("Location"); 

The registry access code is in Microsoft.Win32 namespace in the mscorelib.dll.

There are properties off of Registry for each of the registry hives, and for the registry key path you will not need to include the registry hive part.

For more information on the Registry Class and RegistryKey Class

Sign up to request clarification or add additional context in comments.

Comments

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.