Lilz
Lilz

Reputation: 4081

System.Diagnostics.Process to run processes, send parameters and get output

I am trying to call a process using System.Diagnostics.Process, send it a parameter, just for the sake of trying it out i am sending "-h" which should generate a list of help options and I need the output.

So far I have tried,

        ProcessStartInfo startInfo = new ProcessStartInfo("C:\\agfl\\agfl.exe");

        startInfo.WindowStyle = ProcessWindowStyle.Normal;
        startInfo.CreateNoWindow = false;



        startInfo.Arguments = "-h";


        Process.Start(startInfo);

Any help please?

Thanks :)

Upvotes: 0

Views: 690

Answers (1)

CDSO1
CDSO1

Reputation: 297


Process process = Process.Start(startInfo);
String result = process.StandardOutput.ReadToEnd();

Upvotes: 1

Related Questions