0

I wrote a small R script that calaulate some calculation and make a csv file (by using write.csv) and it's work fine when running the script. Now I want this script run from .bat file, what i have to wrote in the .bat file?

yudyud
  • 27
  • 1
  • 6

1 Answers1

0

Use Rscript which is in the same folder as R.

Usage: Rscript myfilename.R

anotherfred
  • 1,330
  • 19
  • 25
  • My batch file is- "R CMD BATCH "C:\Program Files\R\R-2.13.1\bin\R.exe "C:\RStudio\DailyRets\Dailyrets.r" sowhat i have to change? – yudyud Nov 10 '17 at 05:10
  • `"C:\Program Files\R\R-2.13.1\bin\Rscript.exe" "C:\RStudio\DailyRets\Dailyrets.r" ` or add Rscript to your `path` and use `Rscript "C:\RStudio\DailyRets\Dailyrets.r" ` https://www.howtogeek.com/118594/how-to-edit-your-system-path-for-easy-command-line-access/ – anotherfred Nov 10 '17 at 06:40
  • Hi, when running a batch file contain this- "C:\Program Files\R\R-2.13.1\bin\Rscript.exe" "C:\RStudio\DailyRets\Dailyrets.r" , thereis a message - the system cannot find. I'm confused, what i have to change now? – yudyud Nov 10 '17 at 09:21