1. 程式人生 > >C# 呼叫exe程式總結

C# 呼叫exe程式總結

已經很久沒有更新部落格,以後關於個人或者團隊在實際中遇到的問題在這裡做個記錄。

先總結一下C#呼叫執行exe程式,簡單直接上程式碼

Thread worker = new Thread(delegate () {
                System.Diagnostics.Process p = new System.Diagnostics.Process();
                p.StartInfo.FileName = AppConst.EngineFilePath;   //exe程式檔案地址
                p.StartInfo.UseShellExecute = false;
                p.StartInfo.RedirectStandardInput = false;
                p.StartInfo.RedirectStandardOutput = false;
                p.StartInfo.RedirectStandardError = false;
                p.StartInfo.CreateNoWindow = true;
                p.StartInfo.Arguments = sb.ToString();  //引數 多個引數使用空格分開               
                p.Start();
                p.WaitForExit();
                p.Close();
                //helper.CsvConvertDataBase(seq);
            });
            worker.Start();