在具有空间的路径中调用可执行文件时出现问题 [英] issue when calling executable in a path that has space
问题描述
我刚在新的Microsoft Windows 7计算机上安装了R,并且在使用命令行时出现以下错误:
I just installed R on a new Microsoft Windows 7 computer and I am running in the following error when using command line:
"C:\Program Files\R\R-3.3.2\bin\Rscript.exe" --version
'C:\Program' is not recognized as an internal or external command,
可运行的程序或批处理文件.
operable program or batch file.
请注意,我在路径周围的引号上方添加了空格.并且我已经在系统路径中添加了:
Note that I have added above the quotes around the path with a space. And that I have added in the system path:
;C:\Program Files\R\R-3.3.2\bin\
有趣的是:
- 如果我仅将其命名为
Rscript.exe --version
,它将给出相同的错误,这非常奇怪:如果找到它,为什么它不能运行它! 我能找到的唯一解释是,在寻找Rscript.exe依赖项时发生错误 - 我还注意到
"C:\Program Files\R\R-3.3.3\bin\x64\Rscript.exe" --version
可行(文件夹...\bin
和...\bin\x64
都有可执行的Rscript.exe)
- if I just call this
Rscript.exe --version
it gives the same error, which is very weird: if it finds it, why can't it run it!?! The only explanation I can find is that the error occurs when looking for a dependency of Rscript.exe - I also noticed that this works
"C:\Program Files\R\R-3.3.3\bin\x64\Rscript.exe" --version
(both folders...\bin
and...\bin\x64
have an executable Rscript.exe)
最后,我确认这是一个R特定的问题,因为我可以在同一命令行界面中调用我在Program Files子文件夹中尝试过的所有其他可执行文件!
Finally I confirm it is an R specific question as all other executables I tried in a subfolder of Program Files can be called through the same command line interface!
推荐答案
我一直在尝试复制您的问题,但在您的问题中发现了一件事:您提到这不起作用:
I have been trying to replicate your issue and I found one thing in your question: You mention that this does not work:
"C:\Program Files\R\R-3.3.2\bin\Rscript.exe" --version
'C:\Program' is not recognized as an internal or external command,
但是这样做:
"C:\Program Files\R\R-3.3.3\bin\x64\Rscript.exe" --version
似乎在适用的示例中使用R-3.3.3,而在无效的示例中使用R-3.3.2.
It seems that you are using R-3.3.3 in the example that works and R-3.3.2 in the example that does not.
所以我认为,如果将其更改为
So I would assume that if you change it to
"C:\Program Files\R\R-3.3.3\bin\Rscript.exe" --version
应该可以.
这篇关于在具有空间的路径中调用可执行文件时出现问题的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!