函数定义
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

相关文章:

  • 2022-12-23
  • 2021-08-16
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2021-10-18
猜你喜欢
  • 2021-12-06
  • 2022-12-23
  • 2022-12-23
  • 2021-04-06
  • 2021-08-09
  • 2021-06-09
相关资源
相似解决方案