日期:2014-05-19  浏览次数:20730 次

控制台程序如何将dos窗口隐藏?
rt
**不是由调用者关闭   **
Process   p=new   Process();
p.StartInfo.UseShellExecute   =   false;
…………
p.StartInfo.CreateNoWindow   =   true;
p.StartInfo.FileName   =   "cmd.exe ";
p.Start();

而是自己隐藏起来  


------解决方案--------------------
p.StartInfo.CreateNoWindow = true; //不显示窗口
------解决方案--------------------
这还不容易
System.Diagnostics.Process p=new System.Diagnostics.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=false;
p.Start();
p.StandardInput.WriteLine(@ "ren d:\aaa d:\bbb ");
/* p.StandardInput.WriteLine( "Exit "); */
什么时候给他个EXIT什么时候他就关闭了
string strOut=p.StandardOutput.ReadToEnd();
richTextBox1.Text = strOut;
p.Close();