Redirecting stdout of one process object to stdin of another

后端 未结 4 766
谎友^
谎友^ 2020-12-15 01:42

How can I set up two external executables to run from a c# application where stdout from the first is routed to stdin from the second?

I know how to run external pro

4条回答
  •  心在旅途
    2020-12-15 02:33

    Use System.Diagnostics.Process to start each process, and in the second process set the RedirectStandardOutput to true, and the in the first RedirectStandardInput true. Finally set the StandardInput of the first to the StandardOutput of the second . You'll need to use a ProcessStartInfo to start each process.

    Here is an example of one of the redirections.

提交回复
热议问题