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();//等待進程關閉或退出後執行以下步驟
.
.
.
.

 

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