C#执行dos命令private void abc() 
{ Process 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 (); 
p.StandardInput.WriteLine("dir"); 
p.StandardInput.WriteLine("exit"); 
p.StandardInput.WriteLine("cd c:\"); 
p.StandardInput.WriteLine("exit"); 
p.StandardInput.WriteLine("dir"); 
p.StandardInput.WriteLine("exit"); 
p.StandardInput.WriteLine("cls"); 
p.StandardInput.WriteLine("exit"); p.Close (); 
}