From C# VS2013, I would like to get the whole path of an application that has been indtalled on win 7.
The post with 7 methods at:
http://stackoverflow.com/questions/6041332/best-way-to-get-application-folder-path
cannot help me because I do Not need the path of the current running application.
I need the path of an application that has been installed (but currently not running).
I have tried
string [] allfiles = Directory.GetFiles(path, "*", SearchOption.AllDirectories)
at
http://stackoverflow.com/questions/23736343/recursive-search-for-files-in-root-directory-and-subfolders
But got:
Additional information: Access to the path 'C:\Program Files\MSSomeApp\DATA' is denied.
My C# code:
FileInfo executableFileInfo = new FileInfo("MyApplication.exe"); // It has been installed on win 7.
string executableDirectoryName = executableFileInfo.DirectoryName;
This just returned my current VS2013 working directory. But, actually, "MyApplication.exe" was installed at C:\MyPath.
I need to get the full file path C:\MyPath\, where all libs and exe files (of MyApplication) are there.
Any suggestions ? thanks