sherif42

sherif42

  • NA
  • 3
  • 0

Process Redirect Input And Output

Oct 27 2004 2:54 PM
Hi All I am trying to create a new process and to read and write in it i used the code below System.Diagnostics.Process p=new System.Diagnostics.Process(); p.StartInfo=new System.Diagnostics.ProcessStartInfo("cmd"); p.StartInfo.RedirectStandardInput=true; p.StartInfo.RedirectStandardOutput=true; p.StartInfo.UseShellExecute = false; p.StartInfo.CreateNoWindow=true; p.Start(); sw = p.StandardInput; sr = p.StandardOutput; sw.AutoFlush = true; sw.WriteLine("dir"); sw.Close(); /// <<<===== MessageBox.Show(sr.ReadToEnd()); Now the proplem is that i don't want to close the inputstream , i want to write again , and read again any body can help ??

Answers (2)