我正在使用第三方軟件工具(命令行工具)將PDF文件合併在一起。使用C#我試圖使用System.Diagnostics.Process來運行可執行文件,但是我根據參數設置提出了一些錯誤。System.Diagnostics.Process問題與工作目錄
- 如果UseShellExecute =真實RedirectStandardOutput =真我得到:
- Process對象必須具有UseShellExecute屬性設置爲False,以重定向IO流。
- 如果UseShellExecute =真,RedirectStandardOutput =假,我得到:
- 該系統找不到指定的文件
- 如果useShellExecute =虛假和RedirectStandardOutput =真我得到:
- 系統找不到指定的文件
- 如果UseShellExecute =虛假和RedirectStandardOutput =假,我得到:
- 該系統找不到指定的文件
運行的代碼如下:
Process p = new Process();
p.StartInfo.UseShellExecute = false;
p.StartInfo.RedirectStandardOutput = false;
p.StartInfo.WorkingDirectory = "C:\\Program Files (x86)\\VeryPDF PDF Split-Merge v3.0";
p.StartInfo.FileName = "pdfpg.exe " + strFileNames.Trim() + " "
+ D2P_Folder_Converted + "\\" + strOutputFileName;
p.Start();
p.WaitForExit();
p.Close();
p.Dispose();
有人可以幫我解決這個問題,請
這個建議與Kevin Gales合併「@」建議效果很好。謝謝你們的幫助。 – mattgcon 2010-02-11 19:18:46