Redirect console output to textbox in separate program

前端 未结 5 2035
误落风尘
误落风尘 2020-11-22 16:16

I\'m developing an Windows Forms application that requires me to call a separate program to perform a task. The program is a console application and I need to redirect stan

5条回答
  •  独厮守ぢ
    2020-11-22 16:57

    I've added a number of helper methods to the O2 Platform (Open Source project) which allow you easily script an interaction with another process via the console output and input (see http://code.google.com/p/o2platform/source/browse/trunk/O2_Scripts/APIs/Windows/CmdExe/CmdExeAPI.cs)

    Also useful for you might be the API that allows the viewing of the console output of the current process (in an existing control or popup window). See this blog post for more details: http://o2platform.wordpress.com/2011/11/26/api_consoleout-cs-inprocess-capture-of-the-console-output/ (this blog also contains details of how to consume the console output of new processes)

提交回复
热议问题