zoukankan      html  css  js  c++  java
  • ServiceController

     1 using System;
     2 using System.Collections.Generic;
     3 using System.Text;
     4 using System.ServiceProcess;
     5 
     6 namespace Study
     7 {
     8     public class ServiceInfo
     9    {
    10         public void ShowServiceInfo()
    11         {
    12             ServiceController[] services=System.ServiceProcess.ServiceController.GetServices();
    13             System.Console.WriteLine("Service名称 Service显示名称 Service状态");
    14             for (int i = 0; i < services.Length; i++)
    15             {
    16                 System.Console.WriteLine(string.Format("{0} {1} {2}", services[i].ServiceName, services[i].DisplayName, services[i].Status.ToString()));
    17             }
    18         }
    19     }

    20 }

    static void Main(string[] args)
           {
                ServiceInfo serviceInfo = new ServiceInfo();
                serviceInfo.ShowServiceInfo();
                Console.ReadLine();
            }

    21 
  • 相关阅读:
    ORM框架
    优酷项目1
    新年第一天
    前端第十天
    前端第九天
    前端第八天
    前端第七天
    前端第六天
    前端第五天
    月亮与六便士
  • 原文地址:https://www.cnblogs.com/tonybinlj/p/1328815.html
Copyright © 2011-2022 走看看