ProcessStartInfo 類別
ProcessStartInfo cmd = new System.Diagnostics.ProcessStartInfo("cmd.exe");
cmd.RedirectStandardInput = true;
cmd.RedirectStandardOutput = true;
cmd.RedirectStandardError = true;
cmd.UseShellExecute = false;
Process 類別
Process console = Process.Start(cmd);
console.StandardInput.WriteLine("D:");
console.StandardInput.WriteLine("exit");
string output = console.StandardOutput.ReadToEnd()
console.Close();
沒有留言:
張貼留言