I am doing remote CMD shell. After writing to StandardInput
i need to read output from StandardOutput
but for it i need to close StandardInput
. How i can write to StandardInput
again?
Process process = new Process();
process.StartInfo.FileName = "cmd.exe";
process.StartInfo.RedirectStandardInput = true;
process.StartInfo.RedirectStandardOutput = true;
process.StartInfo.UseShellExecute = false;
process.StartInfo.CreateNoWindow = true;
process.Start();
process.StandardInput.WriteLine("dir");
process.StandardInput.Close();
nextOutput = Encoding.UTF8.GetBytes(process.StandardOutput.ReadToEnd());