Writing to a process

Sep 18 2003 12:00 PM
Hi all, I appreciate some help on this code. I'm trying to execute an external application, which takes some parameters. I was able to execute it but not able to pass any parms to it. I’m using StreamWriter to do this but getting an error "StandardIn has not been redirected.". IS this the only way to do it. I have tried various things but ran out of options. Any help is appreciated. my code: ------ using System; using System.Diagnostics; using System.IO; using System.Threading; namespace ConsoleApplication5 { /// /// Summary description for Class1. /// class Class1 { /// /// The main entry point for the application. /// [STAThread] static void Main(string[] args) { Process p = new Process(); StreamWriter sw; ProcessStartInfo psI = new ProcessStartInfo"ping"); psI.RedirectStandardInput = true; psI.UseShellExecute = false; psI.CreateNoWindow = true; p.StartInfo = psI; sw = p.StandardInput; sw.AutoFlush = true; sw.WriteLine(); p.Start(); Thread.Sleep(9000); } } } Thanks John

Answers (2)