4
A
回答
6
我不知道你是否會找到一個直接的例子,但它不是太困難。我沒有時間爲你寫的所有代碼,但我可以給你從MSDN代碼:
Process myProcess = new Process();
ProcessStartInfo myProcessStartInfo =
new ProcessStartInfo("C:\\MyBatchFile.bat");
myProcessStartInfo.UseShellExecute = false;
myProcessStartInfo.RedirectStandardOutput = true;
myProcess.StartInfo = myProcessStartInfo;
myProcess.Start();
StreamReader myStreamReader = myProcess.StandardOutput;
// Read the standard output of the spawned process.
string myString = myStreamReader.ReadToEnd();
myProcess.Close();
// Now you have the output of the batch file in myString
1
看到這個answer這裏。
它會告訴你如何將輸出重定向到一個事件。然後,您可以拿出輸出並將其放入您的雙贏控制中。
相關問題
- 1. 如何僅使用C#顯示批處理文件輸出的特定行
- 2. 批處理文件和Windows調度程序的簡單示例
- 3. 在.txt文件中顯示批處理腳本輸出
- 4. JSR 352批處理應用示例
- 5. 尋找Adobe Air(flex)應用程序生成word文檔的示例/示例
- 6. 批處理程序顯示具有完整目錄的文件
- 7. 批處理文件輸出
- 8. 批處理文件變量顯示
- 9. 批處理文件顯示批處理命令
- 10. Winforms登錄應用程序示例?
- 11. 示例onLoad處理程序?
- 12. 調用C#程序後的批處理文件錯誤處理
- 13. 應用程序不顯示輸出
- 14. Java應用程序不顯示輸出
- 15. 尋找c#異常處理程序
- 16. VB.Net突出顯示的文本事件處理程序
- 17. 輸入變量名和顯示 - 批處理文件
- 18. PowerShell批處理文件切換顯示觸摸輸入面板
- 19. jQuery的示例應用程序來尋找最佳實踐
- 20. 尋找「pylons + sqlalchemy」的示例應用程序
- 21. 批處理程序在文本文件中輸出'dir'
- 22. cmd /批處理文件沒有顯示,也沒有按順序記錄其他程序的輸出
- 23. 沒有顯示窗口C#應用程序處理中的telnet
- 24. vb.Net c#運行批處理文件並輸出其輸出
- 25. 顯示從文本文件中的行批處理文件
- 26. 使用活動連接的批處理文件ftp示例
- 27. 如何從批處理文件執行c#console應用程序
- 28. 批處理文件輸出的Unicode
- 29. 尋找DTLS非阻塞程序示例(C/C++)
- 30. C#.dat文件上傳文件到FTP苦苦尋找工作示例爲我的控制檯應用程序
我會建議'myStreamReader.ReadToEnd();',但堅實的+1。 ;) – Lance 2010-06-18 15:30:15
@ Lance May - 我希望在發佈前做出更改。這是MSDN最初使用的。我做了更新。 – 2010-06-18 15:35:21