When calling an executable in a path with space

I just installed R on a new Microsoft Windows 7 computer and I am running the following error when using the 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, 

operational program or batch file.

Note that I added above quotes around the path with a space. And what I added to the system path:

;C:\Program Files\R\R-3.3.2\bin\

Interesting:

  • If I just call it Rscript.exe --version , it will give the same error, which is very strange: if she finds it, why can't she run it!?! The only explanation I can find is that the error occurs when searching for the Rscript.exe dependency
  • 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 Rscript.exe executable file)

Finally, I confirm that this is a specific R question, since all other executables that I tried in the Program Files subfolder can be called via the same command line interface!

+5
source share
2 answers

I am trying to reproduce your problem, and I found one 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, 

But it does:

 "C:\Program Files\R\R-3.3.3\bin\x64\Rscript.exe" --version 

It seems that you are using R-3.3.3 in an example that works, and R-3.3.2 in an example that does not.

So, I would suggest that if you change it to

 "C:\Program Files\R\R-3.3.3\bin\Rscript.exe" --version 

he should work.

+2
source

Departure

 C:\Users>Rscript --help Usage: /path/to/Rscript [--options] [-e expr [-e expr2 ...] | file] [args] --options accepted are --help Print usage and exit --version Print version and exit --verbose Print information on progress --default-packages=list Where 'list' is a comma-separated set of package names, or 'NULL' or options to R, in addition to --slave --no-restore, such as --save Do save workspace at the end of the session --no-environ Don't read the site and user environment files --no-site-file Don't read the site-wide Rprofile --no-init-file Don't read the user R profile --restore Do restore previously saved objects at startup --vanilla Combine --no-save, --no-restore, --no-site-file --no-init-file and --no-environ 'file' may contain spaces but not shell metacharacters Expressions (one or more '-e <expr>') may be used *instead* of 'file' See also ?Rscript from within R 

Pursuing my theory that some kind of addiction is to blame, I was hoping that -verbose would indicate that other Rscript files were trying to read. There is no such luck.

By the way, almost none of these options is applicable to me if I did not provide some commands to Rscript, otherwise it continues to complain, "the file name is missing." So with any of these possibilities you can go with something like

 C:\Users>Rscript --verbose -e print(2+2) 

To say that you can continue your theory using options such as --no-environ , --no-site-file , --vanilla , etc., to skip any dependencies between files and see if it delivers you somewhere.

0
source

Source: https://habr.com/ru/post/1272589/


All Articles