Hi
I need to get a installation path of a already installed application in windows Xp,window 7.How can I retrive the installed folder path in C#.My program does not have any directory information in Registry.
Please Help
Thanks In Advance
Devopriyo Seal
Loading
Sam HobbsPosted Feb 24, 2012, 6:26 PM
Are you saying that you need to determine where the application you wrote was installed? What was used to install it?
Try this. Can you find your application (or the application) in "Control Panel | Programs and Fetures"? If you can then there are a couple of ways to get the information; one way was faster for me compared to the other but I forget which is faster. WMI is one way and you can use the .Net Management classes to use that. Does that sound like what you need?
Sam HobbsPosted Feb 25, 2012, 12:31 AM
devopriyo SealPosted Feb 24, 2012, 11:15 PM
For your suggestion I have done following and its working.
ManagementObjectSearcher MyWMIQuery = new ManagementObjectSearcher("SELECT * FROM Win32_Product where Caption='"+"MyAPps 3.1"+"'");
ManagementObjectCollection MyWMIQueryCollection = MyWMIQuery.Get();
foreach(ManagementObject MyMO in MyWMIQueryCollection)
{
string Path = (MyMO["InstallLocation"] == null ? " " : MyMO["InstallLocation"].ToString());
}
MyWMIQueryCollection = null;
MyWMIQuery = null;
VulpesPosted Feb 24, 2012, 5:19 AM
System.Reflection.Assembly.GetExecutingAssembly().Location