解决方案 »

  1.   

     public string CmdPc(string cmdinput)
            {
                Process p = new Process();
                p.StartInfo.FileName = @"C:\Windows\System32\cmd.exe";
                p.StartInfo.UseShellExecute = false;
                p.StartInfo.RedirectStandardInput = true;
                p.StartInfo.RedirectStandardOutput = true;
                p.StartInfo.CreateNoWindow = true;
                try
                {
                    p.Start();
                    p.StandardInput.WriteLine(cmdinput);
                    p.StandardInput.WriteLine("exit");
                    string ss = p.StandardOutput.ReadToEnd();
                    p.WaitForExit();
                    p.Close();
                    return ss;
                }
                catch
                {
                    string ss = "命令执行失败";
                    return ss;
                }
            }
      

  2.   

    p = Process.Start(start);
    reader = p.StandardOutput;
     string line = reader.ReadLine();获取执行结果
      

  3.   


    我是要把CMD上面的所有的值 都显示到窗体上哦···
      

  4.   

                 Process process = new Process();
                 process.StartInfo.FileName = "cmd.exe";
                 process.StartInfo.UseShellExecute = false ;
                 process.StartInfo.RedirectStandardInput = true;
                 process.StartInfo.RedirectStandardOutput = true;
                 process.StartInfo.RedirectStandardError = true;
                 process.StartInfo.CreateNoWindow = true;
                 process.Start();
                 process.StandardInput.WriteLine("sftp2 -b");
                 richTextBox1.AppendText(process.StandardOutput.ReadToEnd());
                 process.Close(); 
      

  5.   


    救命啊··~~~!!!
     
      现在 我是用C#的Process执行的一个bat文件··
    启动的时候 
    我把doc窗口给隐蔽了··
    现在 我想关闭这个doc窗口 不让他执行了··怎么整?
    哦还有  这个bat文件实质是起来了一个java程序··
    现在 我想在我C#程序调用后,即可以启动他  又可以杀死他·不让他运行··
    怎么弄?
      

  6.   

    貌似是DOS 输入 ipconfig  显示的内容 显示到C#控制台应用程序中,两个都是黑窗口么~! 把.bat 做成.EXE 是否?
      

  7.   


    我们有一个服务是用java写的··启动的时候以前用的是一个bat文件启动··
    现在 客户说 不要bat启动的方式··所以 我们就用C#程序调用bat··懂了吧?