现在有一个 C#写的exe,没有源码,请问怎样在他运行的时候,捕获到程序 Console.writeline的内容呢?
不知道有没有什么工具,可以实现,先谢谢
[解决办法]
用Process类。。
[解决办法]
输出重定向
Process p = new Process();
// Redirect the output stream of the child process.
p.StartInfo.UseShellExecute = false;
p.StartInfo.RedirectStandardOutput = true;
p.StartInfo.FileName = @"CslParentCls.exe";
p.Start();
// Do not wait for the child process to exit before
// reading to the end of its redirected stream.
// p.WaitForExit();
// Read the output stream first and then wait.
string output = p.StandardOutput.ReadToEnd();
p.WaitForExit();