Advertisement
Guest User

Untitled

a guest
Dec 7th, 2019
100
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.87 KB | None | 0 0
  1. using System.Diagnostics;
  2.  
  3. namespace Adapters
  4. {
  5. public static class Cmd
  6. {
  7. /// <summary>
  8. /// процесс cmd
  9. /// </summary>
  10. private static readonly Process cmd = new Process
  11. {
  12. StartInfo =
  13. {
  14. FileName = "cmd.exe",
  15. CreateNoWindow = true,
  16. UseShellExecute = false,
  17. RedirectStandardInput = true
  18. }
  19. };
  20.  
  21. /// <summary>
  22. /// Запускает cmd с аргументами
  23. /// </summary>
  24. /// <param name="bath"></param>
  25. public static void Run(string bath)
  26. {
  27. cmd.Start();
  28. cmd.StandardInput.WriteLine(bath);
  29. cmd.StandardInput.Flush();
  30. cmd.StandardInput.Close();
  31. cmd.WaitForExit();
  32. }
  33. }
  34. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement