我打包的安装部署,安装软件后自动启动服务是用
  private void serviceInstaller1_AfterInstall(object sender, InstallEventArgs e)
  {
  Process p = new Process();
  p.StartInfo.FileName = "cmd.exe";
  p.StartInfo.UseShellExecute = false;
  p.StartInfo.RedirectStandardInput = true;
  p.StartInfo.RedirectStandardOutput = true;
  p.StartInfo.RedirectStandardError = true;
  p.StartInfo.CreateNoWindow = true;
  p.Start();
  string Cmdstringp = "sc start HG.TurnArchivesService"; //CMD命令
  p.StandardInput.WriteLine(Cmdstringp);
  p.StandardInput.WriteLine("exit");
  }
可是卸载前用
  private void serviceInstaller1_BeforeInstall(object sender, InstallEventArgs e)
  {
  Process p = new Process();
  p.StartInfo.FileName = "cmd.exe";
  p.StartInfo.UseShellExecute = false;
  p.StartInfo.RedirectStandardInput = true;
  p.StartInfo.RedirectStandardOutput = true;
  p.StartInfo.RedirectStandardError = true;
  p.StartInfo.CreateNoWindow = true;
  p.Start();
  string Cmdstringp = "sc stop HG.TurnArchivesService"; //CMD命令
  p.StandardInput.WriteLine(Cmdstringp);
  p.StandardInput.WriteLine("exit");
  }
不能停止服务,谁有什么方法可以在卸载前停止服务