private string GetServicePathName(string servicename)
{
string RetString = string.Empty;
string query = “select PathName from Win32_Service where name=’”+servicename+"’";
ManagementObjectSearcher searcher = new ManagementObjectSearcher(query);
foreach(ManagementObject ob in searcher.Get())
{
RetString = ob[“PathName”].ToString();
break;
}
searcher.Dispose();
return RetString;
}
C# 根据服务名称获取服务程序集路径
最新推荐文章于 2021-05-18 14:09:49 发布