I have a batch file with the following code:
mybat.bat
cd "%~dp0"
"C:\Program Files\R\R-3.4.2\bin\i386\Rterm.exe" --no-restore --no-save
< app.r > "shiny.log" 2>&1
The path to R is hardcoded and it runs well executing my 'appr.r' script. However, I would like to use a dynamic path to R because R might be on a different directory depending on which laptop I am using. My question is: is it possible to get the relative path of R in a batch file? I have some code that I use in an R script to find the relative path to R but I am not able to implement it in a batch file. How can I use the following code in a batch file to find the path to R?:
system2(paste(R.home("bin"), "/R", sep=""), args="CMD BATCH app.r
shiny.log")