SHARE
TWEET

Untitled

a guest Feb 21st, 2019 68 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. System.Diagnostics.Process process = new System.Diagnostics.Process();
  2. System.Diagnostics.ProcessStartInfo startInfo = new System.Diagnostics.ProcessStartInfo();
  3.  
  4. startInfo.WindowStyle = System.Diagnostics.ProcessWindowStyle.Hidden;
  5. startInfo.FileName = "cmd.exe";
  6. startInfo.Arguments = "/C SomeEXE inputfile.txt";
  7. startInfo.UseShellExecute = false;
  8. startInfo.RedirectStandardOutput = true;
  9.  
  10. process.StartInfo = startInfo;
  11. process.Start();
  12.  
  13. // Now use streams to capture the output
  14. StreamReader outputReader = process.StandardOutput;
  15.  
  16. process.WaitForExit();
  17.  
  18. String line = outputReader.ReadToEnd();
  19.    
  20. startInfo.FileName = "SomeEXE";
  21. startInfo.Arguments = "inputfile.txt";
  22.    
  23. myProcess.StartInfo.RedirectStandardInput = true;
  24. StreamWriter myStreamWriter = myProcess.StandardInput;
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top