[英]How to run R.exe without args in WPF
我創建了一個進程來運行“cmd.exe”並重定向標准輸出、標准錯誤、標准輸入。 看起來效果不錯。 但是當我輸入“R”並嘗試運行“R.exe”時,它不起作用並顯示以下消息。
致命錯誤:您必須指定 '--save'、'--no-save' 或 '--vanilla'
Process _process = new Process();
ProcessStartInfo _startInfo = new ProcessStartInfo();
_startInfo.FileName = "cmd.exe";
_startInfo.Arguments = "";
_startInfo.RedirectStandartInput = true;
_startInfo.RedirectStandartOutput = true;
_startInfo.RedirectStandartError = true;
_startInfo.CreateNoWindows = true;
我希望運行“cmd.exe”的進程可以在輸入“R”而沒有其他參數后運行 R.exe。
當前Output
預計 Output
我嘗試輸入可執行文件的完整路徑。 它顯示相同的結果。 但是,如果 ProcessStartInfo 發生了變化,它確實可以按我的預期工作。
_startInfo.CreateNoWindows = false;
我發現了一個有趣的外觀。
當 CMD 在系統進程中運行時,我嘗試重定向 R.exe 的 output 並輸入“R > D:\a.txt”。 並且還會顯示致命錯誤消息。
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.