I need to check where a program is installed by program name (name that appears in Add or Remove Programs). What is the best way to that so that it\'d work fine for all lang
You can achieve this using WMI Classes. But the prerequisite is
below the sample code to do this
string queryString =
"SELECT Name, ProcessId, Caption, ExecutablePath" +
" FROM Win32_Process";
SelectQuery query = new SelectQuery(queryString);
ManagementScope scope = new System.Management.ManagementScope(@"\\.\root\CIMV2");
ManagementObjectSearcher searcher = new ManagementObjectSearcher(scope, query);
ManagementObjectCollection processes = searcher.Get();
foreach(ManagementObject mObj in processes)
{
var name = mObj ["Name"].ToString();
var ProcessId = Convert.ToInt32(mObj ["ProcessId"]);
var Caption = mObj ["Caption"].ToString();
var Path = mObj ["ExecutablePath"].ToString();
}