Windows service
-
hi all.. can any help to find the windows service path..?? i have tried in following 3 ways... but i didn't get it. 1. System.IO.Path.GetDirectoryName(System.Reflection.Assembly.GetExecutingAssembly().GetName().CodeBase).Substring(6)); 2. AppDomain.CurrentDomain.SetupInformation.PrivateBinPath); 3. System.Management.ManagementObjectSearcher sor =new System.Management.ManagementObjectSearcher("SELECT PathName FROM Win32_Service WHERE Name =MyWinService" ); foreach (ManagementObject mo in sor.Get()) { strwriter.Write(Path.GetDirectoryName(mo["PathName"].ToString())); } } thank you.
siri
-
hi all.. can any help to find the windows service path..?? i have tried in following 3 ways... but i didn't get it. 1. System.IO.Path.GetDirectoryName(System.Reflection.Assembly.GetExecutingAssembly().GetName().CodeBase).Substring(6)); 2. AppDomain.CurrentDomain.SetupInformation.PrivateBinPath); 3. System.Management.ManagementObjectSearcher sor =new System.Management.ManagementObjectSearcher("SELECT PathName FROM Win32_Service WHERE Name =MyWinService" ); foreach (ManagementObject mo in sor.Get()) { strwriter.Write(Path.GetDirectoryName(mo["PathName"].ToString())); } } thank you.
siri
See the following link, this will help you: http://msdn.microsoft.com/en-us/library/aa394418(VS.85).aspx[^]