• 设置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
                { }
            }
  • 相关阅读:
    linux 解压文件
    linux 文件夹操作
    adb 安装apk报INSTALL_FAILED_NO_MATCHING_ABIS
    Android Tab类型主界面 Fragment+TabPageIndicator+ViewPager
    Android 图表
    Android Manifest文件
    BroadcastReceiver介绍
    Android dimen
    Android Dialog
    Android 获取加速传感器的值,并去除杂音
  • 原文地址:https://www.cnblogs.com/94cool/p/1710289.html
Copyright © 2020-2023  润新知