Reputation: 1269
I'm running an external exe from a C# windows application. The exe is an console window and i pass initial command line arguments "a and b" like this
Process p = new Process();
p.StartInfo.FileName = "something.exe";
p.StartInfo.Arguments = "a b";
p.Start();
p.WaitForExit();
p.Close();
Now i need to pass the second arguments in the same exe that is the application "something.exe" starts execution with the initial arguments a and b and then it further needs some inputs c and d in the next step. How can i give the second input c and d in the C# application. Please provide me a solution.
Upvotes: 0
Views: 434
Reputation: 1269
Got it guys
Process p = new Process();
p.StartInfo.FileName = "something.exe";
p.StartInfo.Arguments = "a b";
**p.StartInfo.UseShellExecute = false;**
**p.StartInfo.RedirectStandardInput = true;**
p.Start();
**p.StandardInput.WriteLine("c");**
**p.StandardInput.WriteLine("d");**
p.WaitForExit();
p.Close();
Upvotes: 1