How to run Windows batch file from R script

For me, it worked like this, but there is also modification needed in the actual batch file.

system("cmd.exe", input = paste('C:\\This\\Is\\Path\\Your.bat'))

In the batch file, I added exit command at the end because that was running in an endless loop.


On the other hand, endless loops with proper timing and conditions in the batch file might be useful.

Two posts that you might be interested in:

How to schedule or periodically loop tasks in Windows

Run Windows command line scripts by condition





Leave a Reply

Your email address will not be published. Required fields are marked *