How to get service execuable path,
Some time we need to get specific service path and then do something you want. there are 2 way to get specific service path bellow.
Private static string GetRegistData (string name) {string registData; RegistryKey hkml = Registry. localMachine; RegistryKey system = hkml. openSubKey ("SYSTEM", true); RegistryKey currentControlSet = system. openSubKey ("CurrentControlSet", true); RegistryKey services = currentControlSet. openSubKey ("services", true); RegistryKey = services. openSubKey (name, true); registData = key. getValue ("ImagePath "). toString (); return registData;} private static string GetServicePath (string name) {ManagementClass mc = new ManagementClass ("Win32_Service"); foreach (ManagementObject mo in mc. getInstances () {if (mo. getPropertyValue ("Name "). toString () = name) {return mo. getPropertyValue ("PathName "). toString (). trim ('"') ;}} return string. empty ;}