调用批处理或可执行文件时,cmd窗口会闪烁一下(出现cmd窗口马上就消失)
请问高手们指点下,怎样做才能使他不闪烁。

解决方案 »

  1.   

    如果是C#写的可执行文件,在最后加一句:
    System.Console.ReadLine();
      

  2.   

    谢了
    可能我说的不是很清楚,我是想执行的时候直接不出现cmd窗口
      

  3.   

    批處理實例
    Rem Test
    @each off
    print 'ss'
    pause
    @each onC#可執行文件﹐在文件尾加上一句:
    System.Console.ReadLine();
      

  4.   

    以前看帖有人说用p.StartInfo.CreateNoWindow=true;
    但是我试过了,没效果
      

  5.   

    不要直接点它,到cmd.exe中运行
      

  6.   

    我刚才解决了。
      Process process=new Process();
      process.StartInfo.FileName="a.bat";
      process.StartInfo.UseShellExecute=false;
      process.StartInfo.RedirectStandardInput = true;
      process.StartInfo.RedirectStandardOutput = true;
      process.StartInfo.RedirectStandardError = true;
      process.StartInfo.CreateNoWindow = true;
      Process.Start();
      

  7.   

    不好意思,没理解你说的我是用C#调用一个EXE文件(不是c#写的)System.Diagnostics.ProcessStartInfo ps=new ProcessStartInfo("my.exe");
    System.Diagnostics.Process p=new System.Diagnostics.Process();
    p.StartInfo.CreateNoWindow=true;
    p.StartInfo=ps;
    p.start();
      

  8.   

    System.Diagnostics.ProcessStartInfo ps=new ProcessStartInfo("my.exe");
    System.Diagnostics.Process p=new System.Diagnostics.Process();
     p.UseShellExecute=false;
     p.RedirectStandardInput = true;
     p.RedirectStandardOutput = true;
     p.RedirectStandardError = true;
    p.StartInfo.CreateNoWindow=true;
    p.StartInfo=ps;
    p.start();