views:

278

answers:

2

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 computations, then terminates (which i need to detect). Essentially, i want to wrap up this interaction in a wrapper class.

Has any one achieved similar in the past? If so, how did you go about it? Did you notice a pattern, or maybe some good build in classes to use? Cheers!

+11  A: 

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).

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

Marc Gravell
cheers, this is exactly what i wanted
NoizWaves
A: 

If all applications are developed in dotnet you can use Assembly class

Ahmed Said