Process Redirect Input And Output
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 ??