how to find the execution path of a installed software

Using C# code you can find the path for some excutables this way:

private const string keyBase = @"SOFTWARE\Microsoft\Windows\CurrentVersion\App Paths";
private string GetPathForExe(string fileName)
{
    RegistryKey localMachine = Registry.LocalMachine;
    RegistryKey fileKey = localMachine.OpenSubKey(string.Format(@"{0}\{1}", keyBase, fileName));
    object result = null;
    if (fileKey != null)
    {
        result = fileKey.GetValue(string.Empty);
        fileKey.Close();
    }


    return (string)result;
}

Use it like so:

string pathToExe = GetPathForExe("wmplayer.exe");

However, it may very well be that the application that you want does not have an App Paths key.

Leave a Comment