天天看点

用C#代码运行一个进程

代码运行一个进程

using System.Diagnostics;

namespace GetNewProcess
    class Program
        static void Main(string[] args)
        {
            RunTheProcess();
        }


        private static void RunTheProcess()
        {
            //先声明需要的类,导入需要的程序集的空间名
            Process p = new Process();
            //指定我们程序所在的路径
            p.StartInfo.FileName = @"Jt.exe";

            p.StartInfo.UseShellExecute = false;
            p.StartInfo.RedirectStandardOutput = true;
            p.StartInfo.RedirectStandardInput = true;
            p.Start();
        }


    }
}