using System.IO; using System.Diagnostics; ProcessStartInfo pro = new System.Diagnostics.ProcessStartInfo("cmd.exe"); pro.UseShellExecute = false; pro.RedirectStandardOutput = true; pro.RedirectStandardError = true; pro.CreateNoWindow = true; pro.Arguments = "/K " + System.Environment.CurrentDirectory + @"\net_create.bat"; pro.WorkingDirectory = System.Environment.CurrentDirectory; System.Diagnostics.Process proc = System.Diagnostics.Process.Start(pro); System.IO.StreamReader sOut = proc.StandardOutput; proc.Close(); string results = sOut.ReadToEnd().Trim(); //回显内容 sOut.Close();