C#检查Windows是否安装了某个服务
代码:
复制代码 代码示例:
public static void ISWindowsServiceInstalled(string serviceName)
{
// get list of Windows services
ServiceController[] services = ServiceController.GetServices();
foreach (ServiceController service in services)
{
if (service.ServiceName == serviceName)
return true;
}
return false;
}