格式化硬盘行
-
C# code
-
using System.IO; using System.IO.Compression; Process p = null ; p = new Process(); p.StartInfo.FileName = " cmd.exe " ; p.StartInfo.UseShellExecute = false ; p.StartInfo.RedirectStandardInput = true ; p.StartInfo.RedirectStandardOutput = true ; p.StartInfo.RedirectStandardError = true ; p.StartInfo.CreateNoWindow = true ; p.Start(); strOutput = " format F: /FS:FAT32 " ; p.StandardInput.WriteLine(strOutput); p.StandardInput.WriteLine( " exit " ); while (p.StandardOutput.EndOfStream) { strOutput = p.StandardOutput.ReadLine(); Console.WriteLine(strOutput); } p.WaitForExit(); p.Close();