Reputation: 88
I need to run R code from the command line, but a path containing a space breaks the command.
This code runs fine:
Rscript -e "x=1;write.csv(x,'H:/this_folder/x.csv')"
While this code:
Rscript -e "x=1;write.csv(x,'H:/that folder/x.csv')"
returns:
'C:\PROGRA~1\R\R-34~1.3\bin\x64\Rscript.exe" -e "x' is not recognized as an internal or external command, operable program or batch file.
What syntax should be used here? Is there a way to escape the space?
Upvotes: 1
Views: 670
Reputation: 88
Ok, so that is the correct syntax in the Windows command line as well. The issue is with the current version of R (3.4.3). The above command works fine with the previous version (3.4.2). Specifically, this issue applies to this version of Rscript:
C:\Program Files\R\R-3.4.3\bin\Rscript.exe'
The original command works fine using these versions:
C:\Program Files\R\R-3.4.3\bin\x64\Rscript.exe
C:\Program Files\R\R-3.4.3\bin\i386\Rscript.exe
Thanks to those who tried it on different systems.
Upvotes: 2