2
Answers

Process Redirect Input And Output

Ask a question
sherif42

sherif42

19y
3k
1
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)