Take the 2-minute tour ×

If I install a software named 'ABC', how could I get the complete installed path in C#.Net if I provide the software name 'ABC' as input ?

share|improve this question
Yeah, you can't. At least not reliably. Give up on this. –  Cody Gray May 26 '11 at 10:31
possible duplicate of How to get a list of installed software products? –  Cody Gray May 26 '11 at 10:33
Given this and your last question, I get the sense you're about to embark down a really bad path doing all sorts of things that you shouldn't be doing in ways that you shouldn't be doing them. –  Cody Gray May 26 '11 at 10:37
add comment

1 Answer

up vote 1 down vote accepted

you can try below

using System.Management;

    ManagementObjectSearcher MyWMIQuery = new ManagementObjectSearcher("SELECT * FROM Win32_Product") ;
    ManagementObjectCollection MyWMIQueryCollection = MyWMIQuery.Get();
    foreach(ManagementObject MyMO in MyWMIQueryCollection) 
        Console.WriteLine("InstallLocation : " + (MyMO["InstallLocation"] == null ? " " : MyMO["InstallLocation"].ToString()));

    MyWMIQueryCollection = null;
    MyWMIQuery = null;
share|improve this answer
add comment

Your Answer


