Best way to interact with Command Line application

前端 未结 3 1572
囚心锁ツ
囚心锁ツ 2020-12-31 23:43

I need to write a component for an application that interacts tightly with a command line application. The command line application asks a series of questions, performs some

3条回答
  •  陌清茗
    陌清茗 (楼主)
    2021-01-01 00:09

    You would need to redirect both the input and output streams, using Process; it is slightly trickier handling both, since you need to be careful that things aren't lost in the buffers (causing deadlock).

    • MSDN : Redirecting input
    • MSDN : Redirecting output
    • Here's a basic alternative example.

    You might also want to look at OutputDataReceived for event-based responses.

提交回复
热议问题