I'm trying for my first time to run an R script from command line on WINDOWS to automate calculation with another program. So I made my R script using R studio and saved it a .bat file with this line
C:\Program Files\R\R-4.0.2\bin CMD BATCH C:\my_directory\my_script.R
Then I putted the script and files the script have to be executed on in the same directory, the one that contains files to run also the program I need. I came throught command line in that directory and I executed the batch file but it doesn't work. I have this as a error message:
"C:\Program Files\R\R-4.0.2\bin"it is not recognized as an internal or external command,
an executable program or batch file.
Where I am wrong? thank you!
cmd /?in a command prompt window explains in last paragraph on last help page that a file name (or any other argument string) containing a space or one of these characters&()[]{}^=;!'+,`~must be enclosed in"to get all the characters inside the double quoted argument string interpreted literally. So I suppose, the right command line is:"C:\Program Files\R\R-4.0.2\bin\R.exe" CMD BATCH "C:\my_directory\my_script.R"R.exe. The correct command is posted in the first comment above.r.exein your script, you should be getting a different error than before. We cant see your screen. You have to provide the error messages and debugging information. Saying it does not work does not help us help you.'C:\Program' is not recognized as an internal or external command, operable program or batch file.