ProcessStartInfo psi=new ProcessStartInfo();
这样启动一个进程可以实现吗?

解决方案 »

  1.   

    string excutepath;//执行路径,包含文件名
    Process p = new Process();
    //设定程序名
    p.StartInfo.FileName = "cmd.exe";
    //关闭Shell的使用
    p.StartInfo.UseShellExecute = false;  
    //重定向标准输入
    p.StartInfo.RedirectStandardInput = true;
    //重定向标准输出
    p.StartInfo.RedirectStandardOutput = true;
    //重定向错误输出
    p.StartInfo.RedirectStandardError = true;
    //设置不显示窗口
    p.StartInfo.CreateNoWindow = true; //这里的显示窗口实际上是指cmd窗口
    p.Start();
    //输入要执行的命令
    p.StandardInput.WriteLine(excutepath);
    p.StandardInput.WriteLine("exit");
      

  2.   

    Process p=new Process();
    p.StartInfo =楼上的psi//楼上的psi需指定文件路径
    p.Start()。
      

  3.   

    ProcessStartInfo psi=new ProcessStartInfo();
    psi.FileName = "可执行文件的路径+文件名.文件名后缀";
    Process p = new Process();
    p.StartInfo = psi;
    p.Start()//ok
      

  4.   

    谢谢大家,这种方法我明白怎么做了,有没有其他方法执行一个exe程序呀?