zoukankan      html  css  js  c++  java
  • windows服务安装

    string[] cmdline = { };
    
                        /*E:	estWindowsServiceTestMyWebin*/
                        string path = Server.MapPath("/bin/");
                        string s = Server.MapPath("/bin/WindowsServiceTest.exe");
                        //AssemblyInstaller installer = new AssemblyInstaller();
                        //installer.Path = Server.MapPath("/bin/WindowsServiceTest.exe");
    
                        //installer.UseNewContext = true;
                        //installer.Install(null);
                        //installer.Commit(null);
                        //installer.Dispose();
    
    
                        #region
                        //TransactedInstaller transactedInstaller = new TransactedInstaller();
                        //AssemblyInstaller assemblyInstaller = new AssemblyInstaller(@"E:	estWindowsServiceTestMyWebinWindowsServiceTest.exe", cmdline);
                        //transactedInstaller.Installers.Add(assemblyInstaller);
                        //transactedInstaller.Install(new System.Collections.Hashtable());
                        #endregion
    
                        #region
                        ProcessStartInfo startInfo = new ProcessStartInfo();
                        startInfo.FileName = "cmd.exe";
                        startInfo.Arguments = "/c C:\Windows\System32\cmd.exe";
                        startInfo.RedirectStandardInput = true;
                        startInfo.RedirectStandardOutput = true;
                        startInfo.RedirectStandardError = true;
                        startInfo.UseShellExecute = false;
                        startInfo.Verb = "RunAs";
                        Process p = new Process();
                        p.StartInfo = startInfo;
    
                        p.Start(); // 启动进程
                        //p.StandardInput.WriteLine(@"del D:123.txt"); // Cmd 命令
    
                        p.StandardInput.WriteLine(@"e:"); // Cmd 命令                 
                        p.StandardInput.WriteLine(@"cd  E:	estWindowsServiceTestWindowsServiceTestinDebug"); // Cmd 命令
                        p.StandardInput.WriteLine(@"installutil WindowsServiceTest.exe"); // Cmd 命令
    
                        p.StandardInput.WriteLine("exit"); // 退出
    
                        #endregion
  • 相关阅读:
    Nginx安装
    node.js搭建vue脚手架
    Oracle引入数据
    MVC引入Junit单元测试
    Git版本控制器
    IDEA-Maven
    SSM框架整合
    【测试基础第五篇】测试用例编写和评审
    【测试基础第四篇】测试用例设计方法
    【测试基础第三篇】需求测试分析
  • 原文地址:https://www.cnblogs.com/tgdjw/p/4955187.html
Copyright © 2011-2022 走看看