Search code examples
rbatch-processingwindows-task-scheduler

R script to Task Scheduler


I have an R script that gets data from databases on another server and brings it into my database. I have it saved as "dataimport.R"

I followed a few answers from here and from other websites and created a batch file like this:

"C:\Program Files\R\R-3.4.0\bin\R.exe" CMD BATCH  --vanilla --slave "C:\dataimport.R" 

This is not working. The cmd window opens up but the tables are not recreated and I dont get any error. I wanted to run the Task Scheduler to automate the process. Any ideas on how to fix this?


Solution

  • I kept at it and interestingly the answer to this was this:

    "C:\Program Files\R\R-3.4.0\bin\R.exe" "C:\dataimport.R"
    

    I dont know the reason for this but as long as it works.