C#中调用Process类时,判断进程是否已结束

命名空间:

using System.Diagnostics;

逻辑代码:

//程序
string str = Server.MapPath("~/Exes/HtmlToPdf.exe");
//参数(注:pageUrl表示访问地址,_pdfHQTemplatePath表示文件路径)
var arguments = " \"" + pageUrl + "\" " + _pdfHQTemplatePath;
Process p = Process.Start(str, arguments);
p.StartInfo.UseShellExecute = false;
p.StartInfo.RedirectStandardInput = true;
p.StartInfo.RedirectStandardOutput = true;
p.StartInfo.RedirectStandardError = true;
p.WaitForExit();//等待进程关闭或退出后执行以下步骤
.
.
.
.

 

發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章