0

I am trying to run Rscript.exe from the command line. It is installed in: D:\Program Files\Microsoft\R Client\R_SERVER\bin\x64. I have added this location to my PATH.

When I run

Rscript --version

I get the following:

'D:\Program' is not recognized as an internal or external command,
operable program or batch file.

It is working fine from RStudio. Can't seem to find a solution other than installing in a separate location without spaces in the path name.

EDIT:

where R: D:\Program Files\Microsoft\R Client\R_SERVER\bin\x64\R.exe

where rscript: D:\Program Files\Microsoft\R Client\R_SERVER\bin\x64\Rscript.exe

set PATH:

Path=C:\Program Files\Microsoft MPI\Bin\;C:\ProgramData\Oracle\Java\javapath;D:\Program Files\Python36\Scripts\;D:\Program Files\Python36\;C:\Program Files (x86)\Intel\iCLS Client\;C:\Program Files\Intel\iCLS Client\;C:\WINDOWS\system32;C:\WINDOWS;C:\WINDOWS\System32\Wbem;C:\WINDOWS\System32\WindowsPowerShell\v1.0\;C:\Program Files (x86)\Intel\Intel(R) Management Engine Components\DAL;C:\Program Files\Intel\Intel(R) Management Engine Components\DAL;C:\Program Files (x86)\Intel\Intel(R) Management Engine Components\IPT;C:\Program Files\Intel\Intel(R) Management Engine Components\IPT;D:\Program Files\Git\cmd;D:\Program Files\nodejs\;C:\Program Files (x86)\Microsoft SQL Server\Client SDK\ODBC\130\Tools\Binn\;C:\Program Files (x86)\Microsoft SQL Server\140\Tools\Binn\;C:\Program Files (x86)\Microsoft SQL Server\140\DTS\Binn\;C:\Program Files (x86)\Microsoft SQL Server\140\Tools\Binn\ManagementStudio\;D:\Program Files (x86)\Yarn\bin;C:\Program Files (x86)\Windows Kits\8.1\Windows Performance Toolkit\;D:\Program Files\MySQL\MySQL Utilities 1.6\;D:\Program Files\CMake\bin;C:\Users\affan.shahid\AppData\Local\Microsoft\WindowsApps;C:\Program Files\Microsoft VS Code\bin;C:\Users\affan.shahid\AppData\Roaming\npm;C:\Users\affan.shahid\AppData\Local\Yarn\bin;D:\Program Files\Microsoft\R Client\R_SERVER\bin\x64;
PATHEXT=.COM;.EXE;.BAT;.CMD;.VBS;.VBE;.JS;.JSE;.WSF;.WSH;.MSC;.PY;.PYW
user3690467
  • 3,049
  • 6
  • 27
  • 54
  • Check the solutions in this link: https://stackoverflow.com/questions/27323518/how-to-run-an-r-script-file-from-the-command-line – Haakonkas Feb 15 '18 at 10:25
  • 1
    Possible duplicate of [How to run an R script file from the command line](https://stackoverflow.com/questions/27323518/how-to-run-an-r-script-file-from-the-command-line) – Haakonkas Feb 15 '18 at 10:26
  • My problem is different. R is in the PATH. – user3690467 Feb 15 '18 at 10:27
  • @user3690467 Please take a look on [What is the reason for '...' is not recognized as an internal or external command, operable program or batch file?](https://stackoverflow.com/a/41461002/3074564) The question itself is actually not related to programming and therefore off-topic for Stack Overflow. How to use the command line right or how to configure `PATH` right is suitable for [Super User](https://superuser.com/), but not for Stack Overflow. – Mofi Feb 15 '18 at 10:38
  • Hm, very interesting. `rscript` on command line should result really in executing `D:\Program Files\Microsoft\R Client\R_SERVER\bin\x64\Rscript.exe`. But this can't result in that error message. Either `rscript.exe` is a batch file "converted" (embedded) into an executable which is not good coded as not working in case of `rscript.exe` is stored in a folder of which path contains a space or one of these characters ``&()[]{}^=;!'+,`~<|>`` or an __alias__ is active on really executing `Rscript`. What does registry key `HKEY_CURRENT_USER\Software\Microsoft\Command Processor` contain? – Mofi Feb 15 '18 at 11:04
  • Does `doskey /macros` or `doskey /macros:all` output anything, especially a line starting with `rscript`? What does registry key `HKEY_CURRENT_USER\Console` contain? You are definitely not the first user with problems using `rscript` a space in path, see [Rscript file path with space](https://stackoverflow.com/questions/48544345/). But your problem is different because even execution of `rscript` itself fails. – Mofi Feb 15 '18 at 11:14

0 Answers0