/// <summary>
/// 启动CMD执行批处理
/// </summary>
/// <param name="workingDirectory">工作目录</param>
/// <param name="cmdLine">执行命令</param>
public static void StartCmd(string workingDirectory, string cmdLine)
{
using (System.Diagnostics.Process p = new System.Diagnostics.Process())
{
p.StartInfo.FileName = "cmd.exe";
p.StartInfo.WorkingDirectory = workingDirectory;
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(cmdLine);
p.StandardInput.WriteLine("exit");
p.StandardOutput.ReadToEnd();
p.Close();
}
}