zoukankan      html  css  js  c++  java
  • 调用控制台程序函数 RunProcess

    函数定义
    private void RunProcess(String executable, String args,Boolean output)
            {
                
    #region
                String line 
    = String.Empty;
                proc
    =new Process();
                
    try
                {
                    proc.StartInfo.FileName 
    = executable;
                    proc.StartInfo.Arguments 
    = args;
                    proc.StartInfo.UseShellExecute 
    = false;
                    proc.StartInfo.RedirectStandardOutput 
    = output;
                    proc.StartInfo.RedirectStandardError 
    = output;
                    proc.StartInfo.CreateNoWindow 
    = false;
                    proc.StartInfo.WindowStyle 
    = ProcessWindowStyle.Hidden;
                    proc.Start();
                    proc.WaitForExit();
                }
        
                
    catch(Exception ex)
                {
                    ex.ToString();
                }
                
    finally
                {
                    proc 
    = null;
                }
                
    #endregion
            }
    说明:
    executable:控制台程序的exe文件所在路径和xxx.exe
    args:运行参数
    output:true
  • 相关阅读:
    JAVA算术运算符
    java框架
    面向对象DAO模式
    JAVA JDK配置
    集合框架
    异常
    centos 部署 aspnetMVC 网页
    SQL四种语言:DDL,DML,DCL,TCL 的区别
    javascript download geoserver layer as kml file
    常用协议 —— hessian://
  • 原文地址:https://www.cnblogs.com/xh831213/p/490523.html
Copyright © 2011-2022 走看看