沧海箫剑
一、启动
string strPathExe = Environment.CurrentDirectory + "\FaceRecognition" + "\IDFaceDemo.exe";
Process process = new System.Diagnostics.Process();
process.StartInfo.FileName = strPathExe;
process.StartInfo.Arguments = null;//-s -t 可以用来关机、开机或重启
process.StartInfo.UseShellExecute = false;
process.StartInfo.RedirectStandardInput = false; //true
process.StartInfo.RedirectStandardOutput = false; //true
process.StartInfo.RedirectStandardError = false;
process.StartInfo.CreateNoWindow = false;
process.Start();//启动
二、关闭
方法1:
process.CloseMainWindow();//通过向进程的主窗口发送关闭消息来关闭拥有用户界面的进程
process.Close();//释放与此组件关联的所有资源
方法2:手动关闭,退出
process.WaitForExit();//等待退出。