ASP.NET运行.bat文件            // Create the ProcessInfo object
ASP.NET运行.bat文件

ASP.NET运行.bat文件            System.Diagnostics.ProcessStartInfo psi 
= new System.Diagnostics.ProcessStartInfo("cmd.exe");
ASP.NET运行.bat文件
ASP.NET运行.bat文件            psi.UseShellExecute 
= false
ASP.NET运行.bat文件
ASP.NET运行.bat文件            psi.RedirectStandardOutput 
= true;
ASP.NET运行.bat文件
ASP.NET运行.bat文件            
//psi.RedirectStandardInput = true;
ASP.NET运行.bat文件

ASP.NET运行.bat文件            psi.RedirectStandardError 
= true;
ASP.NET运行.bat文件
ASP.NET运行.bat文件            psi.Arguments 
= "/K C:\\temp\\test.bat";
ASP.NET运行.bat文件
ASP.NET运行.bat文件            psi.WorkingDirectory 
= "c:\\temp\\";
ASP.NET运行.bat文件
ASP.NET运行.bat文件 
ASP.NET运行.bat文件
ASP.NET运行.bat文件            
// Start the process
ASP.NET运行.bat文件

ASP.NET运行.bat文件            System.Diagnostics.Process proc 
= System.Diagnostics.Process.Start(psi);
ASP.NET运行.bat文件
ASP.NET运行.bat文件            
// Attach the output for reading
ASP.NET运行.bat文件

ASP.NET运行.bat文件            System.IO.StreamReader sOut 
= proc.StandardOutput;
ASP.NET运行.bat文件
ASP.NET运行.bat文件            proc.Close();
ASP.NET运行.bat文件
ASP.NET运行.bat文件 
ASP.NET运行.bat文件
ASP.NET运行.bat文件            
// Read the sOut to a string.
ASP.NET运行.bat文件

ASP.NET运行.bat文件            
string results = sOut.ReadToEnd().Trim();
ASP.NET运行.bat文件
ASP.NET运行.bat文件            sOut.Close();
ASP.NET运行.bat文件
ASP.NET运行.bat文件            
// Write out the results.
ASP.NET运行.bat文件

ASP.NET运行.bat文件            
string fmtStdOut = "<font face=courier size=0>{0}</font>";
ASP.NET运行.bat文件
ASP.NET运行.bat文件            
this.Response.Write(String.Format(fmtStdOut, results.Replace(System.Environment.NewLine, "<br>")));

相关文章:

  • 2022-12-23
  • 2022-12-23
  • 2022-01-13
  • 2021-09-10
  • 2021-12-13
  • 2022-12-23
  • 2021-12-04
猜你喜欢
  • 2022-12-23
  • 2022-01-02
  • 2021-11-06
  • 2021-12-04
  • 2022-12-23
  • 2022-12-23
相关资源
相似解决方案