我正在尝试使用 shell 命令从 R 运行简单的外部应用程序。
shell('"C:\\Program Files\\SomeApp\\bin\\Release\\SomeApp.exe" "C:\\Users\\SomeUser\\R_Scripts\\RProjects\\Rprojects\\" "1" "yes"')
Run Code Online (Sandbox Code Playgroud)
如果我从命令行运行括号中的部分,它可以完美运行。但是如果我通过 R 的 shell 命令运行它,它会抛出一个错误:
'C:\Program' is not recognized as an internal or external command, operable program or batch file.
Warning messages:
1: running command 'C:\Windows\system32\cmd.exe /c "C:\Program Files\SomeApp\bin\Release\SomeApp.exe" "C:\Users\SomeUser\R_Scripts\RProjects\Rprojects\" "1" "yes"' had status 1
2: In shell("\"C:\\Program Files\\SomeApp\\bin\\Release\\SomeApp.exe\" \"C:\\Users\\SomeUser\\R_Scripts\\RProjects\\Rprojects\\\" \"1\" \"yes\"") :
'"C:\Program Files\SomeApp\bin\Release\SomeApp.exe" "C:\Users\SomeUser\R_Scripts\RProjects\Rprojects\" "1" "yes"' execution failed with error code 1
Run Code Online (Sandbox Code Playgroud)
有没有其他人面临同样的问题?
Space separated text should be double quoted. This works for R's shell command.
shell('C:\\"Program Files"\\SomeApp\\bin\\Release\\SomeApp.exe "C:\\Users\\SomeUser\\R_Scripts\\RProjects\\Rprojects\\" "1" "yes"')
Run Code Online (Sandbox Code Playgroud)
归档时间: |
|
查看次数: |
1225 次 |
最近记录: |