zoukankan      html  css  js  c++  java
  • 设置c#windows服务描述及允许服务与桌面交互

    private void ProjectInstaller_AfterInstall(object sender, InstallEventArgs e)
            {
                try
                {
                    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 Cmdstring = "Net Start Service1"; //CMD命令
                    string Cmdstring = "sc config " + serviceInstaller1.ServiceName + " type= interact type= own";
                    p.StandardInput.WriteLine(Cmdstring);
                    Cmdstring = "sc start " + serviceInstaller1.ServiceName;
                    p.StandardInput.WriteLine(Cmdstring);
                    p.StandardInput.WriteLine("exit");
                }
                catch
                { }
            }
  • 相关阅读:
    InSAR 大气校正数据 GACOS
    java通用的方法整理
    Jquery实现select左右栏的添加移除
    kendo ui之grid列表
    kendo-ui学习笔记(一)
    kendo-ui学习笔记——题记
    chrome driver驱动地址
    适合引入缓存的业务及影响
    个人测试方法论202108
    Redis缓存
  • 原文地址:https://www.cnblogs.com/94cool/p/1710289.html
Copyright © 2011-2022 走看看