WindowsForms获取服务名称
2021-06-11 21:05
标签:txt 添加 name close ice build services nbsp new WindowsForms获取服务名称 标签:txt 添加 name close ice build services nbsp new 原文地址:https://www.cnblogs.com/enych/p/10543813.html StringBuilder sb = new StringBuilder();
ServiceController[] services = ServiceController.GetServices(); //需要添加引用程序程序集Serviceprocess
foreach (ServiceController sController in services)
{
//sb.AppendFormat("{0} :{1}",sController.ServiceName,sController.Status);
sb.AppendFormat("{0}", sController.ServiceName);
sb.Append("\r\n");
}
var result = sb.ToString();
System.IO.File.WriteAllText(@"back1.txt", result, Encoding.UTF8);
MessageBox.Show("完成!");
this.Close();
文章标题:WindowsForms获取服务名称
文章链接:http://soscw.com/index.php/essay/93710.html