System Command with Space in R

笑着哭i 提交于 2019-12-29 08:16:12

问题


I run a system command with spaces in directory name as followed:

command=paste(shQuote("java -jar C:/DIR A/DF.jar -t"), t1, t2)

I tried also:

command=paste('"java -jar C:/DIR A/DF.jar -t"', t1, t2)

However I get the following:

Error in system(command, intern = TRUE) : 
  '"java -jar C://DIR A/DF.jar -t"' not found

How can I handle space in directory name in Windows?


回答1:


Here is the solution

command=paste('java -jar "C:/DIR A/DF.jar" -t', t1, t2)

use " only for the dir name and the outside with '



来源:https://stackoverflow.com/questions/32541926/system-command-with-space-in-r

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!