I would like to execute Rscript on a windows computer. For this, I need to find the exact location of Rscript, since it is not on %PATH%. Searching stackoverflow, I found this approach
where /r "c:\Program Files" Rscript.exe
which produces three lines:
c:\Program Files\R\R-3.6.2\bin\Rscript.exe
c:\Program Files\R\R-3.6.2\bin\i386\Rscript.exe
c:\Program Files\R\R-3.6.2\bin\x64\Rscript.exe
Now I do not know how to proceed. How can I assign one of the three lines to a (local) environment variable in windows cmd? Ideally, it would be the first or third line, i.e. the x64 rscript.exe.
Another approach I found on SO is like this:
set "src=c:\Program Files"
set "search=Rscript.exe"
for /r "%src%" %%F in (*%search%*) do (
set "full=%%~fF"
set "name=%%~nxF"
echo %full%
)
but somehow nothing gets assigned to %full%.
Since I would like to run the batch file on more than one computer, I would like to avoid doing extra configuration on these computers (like setting PATH or R_HOME or assigning Rscript to .R files or...)