NoWar
NoWar

Reputation: 37633

How to find an application installation path in the ms windows registry via EXE name

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!

Upvotes: 0

Views: 1273

Answers (1)

JG in SD
JG in SD

Reputation: 5607

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

Upvotes: 1

Related Questions