日期:2014-05-17  浏览次数:20816 次

C# 调用bat文件
用c#调用bat文件,如何不弹出doc窗口呢,
  ProcessStartInfo p = new ProcessStartInfo();
  p.WindowStyle = ProcessWindowStyle.Hidden;
  p.ErrorDialog = false;
  p.CreateNoWindow = false;这样doc窗口也会一闪而消失,如何不出现这种情况呢?
请各位dx指教啊。


------解决方案--------------------
Process p = new Process();
p.StartInfo.FileName = "123.bat";
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();