【问题标题】:How to read console output in ASP.NET?如何在 ASP.NET 中读取控制台输出?
【发布时间】:2014-03-24 06:27:31
【问题描述】:

我想从控制台(cmd)读取数据我试过这段代码

compiler.StartInfo.RedirectStandardOutput = true;
compiler.Start();
compiler.StandardOutput.ReadToEnd();

但它不工作

【问题讨论】:

  • 定义不工作

标签: c# asp.net console stdout


【解决方案1】:

试试这个

Process compiler = new Process();
compiler.StartInfo.FileName = "SOME.exe";
compiler.StartInfo.Arguments = "SOME ARG";
compiler.StartInfo.UseShellExecute = false;
compiler.StartInfo.RedirectStandardOutput = true;
compiler.Start();    

var result=compiler.StandardOutput.ReadToEnd();

compiler.WaitForExit();

【讨论】:

猜你喜欢
  • 1970-01-01
  • 1970-01-01
  • 2011-05-15
  • 1970-01-01
  • 2013-04-26
  • 1970-01-01
  • 1970-01-01
  • 2021-09-03
  • 1970-01-01
相关资源
最近更新 更多