代码及注释
ServiceController sc = new ServiceController("gupdatem"); sc.Stop();//停止服务 sc.Start();//开始 sc.Status.ToString();//运行状态; RegistryKey rk =Registry.LocalMachine.OpenSubKey(@"SYSTEMCurrentControlSetServices360AntiHacker"); if (rk!=null) { rk.GetValue("imagePath").ToString();//取服务路径 rk.GetValue("Start").ToString();//服务运行方式 1,2,3,4 没有方式 自动 手动 禁用 }