日期:2014-05-18  浏览次数:20725 次

c# 执行dos命令问题
大家帮我看看问题出在哪里,执行完后,一点效果也没有。(应该弹出dos出口才对)
string fileName = Path.Combine(Path.GetDirectoryName(this.GetType().Assembly.Location), "moveuser.exe");
  ProcessStartInfo expressStartInfo = new ProcessStartInfo();
  expressStartInfo.FileName =fileName;
  expressStartInfo.Arguments = txtSource.Text.Trim() + " " + txtPurPose.Text.Trim() + " " + "/y/k";
  expressStartInfo.CreateNoWindow = true;
  expressStartInfo.RedirectStandardError = true;
  expressStartInfo.RedirectStandardInput = true;
  expressStartInfo.RedirectStandardOutput = true;
  expressStartInfo.UseShellExecute = false;
  using (Process expressProc = new Process())
  {
  expressProc.StartInfo = expressStartInfo;
  expressProc.StartInfo.WindowStyle = ProcessWindowStyle.Normal;
  expressProc.Start();
  //expressProc.WaitForExit();
   
   
  }

------解决方案--------------------
参考
http://blog.csdn.net/yysyangyangyangshan/article/details/6799489
------解决方案--------------------
expressStartInfo.CreateNoWindow = false;