[英]How to run R.exe without args in WPF
I create a process to run 'cmd.exe' and redirect the stdout,stderr,stdin.我创建了一个进程来运行“cmd.exe”并重定向标准输出、标准错误、标准输入。 It seems work good.
看起来效果不错。 But when I input 'R' and try to run 'R.exe', it doesn't work and show the message below.
但是当我输入“R”并尝试运行“R.exe”时,它不起作用并显示以下消息。
Fatal error: you must specify '--save','--no-save' or '--vanilla'
致命错误:您必须指定 '--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;
I expect that the process which is runing 'cmd.exe' can run R.exe after inputting 'R' without another args.我希望运行“cmd.exe”的进程可以在输入“R”而没有其他参数后运行 R.exe。
Current Output当前Output
Expected Output预计 Output
I have try to input the full path to the executable.我尝试输入可执行文件的完整路径。 It show the same result.
它显示相同的结果。 But if the ProcessStartInfo is changed, it does work as I expect.
但是,如果 ProcessStartInfo 发生了变化,它确实可以按我的预期工作。
_startInfo.CreateNoWindows = false;
And I find an interesting appearance.我发现了一个有趣的外观。
When CMD is running in system process, I try to redirect the output of R.exe and input "R > D:\a.txt".当 CMD 在系统进程中运行时,我尝试重定向 R.exe 的 output 并输入“R > D:\a.txt”。 And the fatal error message will be alse shown.
并且还会显示致命错误消息。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.