nevil amos
2015-Jan-30 04:26 UTC
[R] How to run sequential Rscript command for windows command line with a batch file.
Hi, I need to run multiple iterations of a script to which I am supplying a single numeric argument I can open the command prompt window and enter a single command: "C:\Program Files\R\R-3.1.0\bin\x64\Rscript.exe" myScript.R.R 18 and it runs OK and saves the outputs. Similarly if I run the same single command from a batch file it works fine however If I have multiple lines in the batch file eg: "C:\Program Files\R\R-3.1.0\bin\x64\Rscript.exe" myScript.R.R 18 "C:\Program Files\R\R-3.1.0\bin\x64\Rscript.exe" myScript.R.R 19 "C:\Program Files\R\R-3.1.0\bin\x64\Rscript.exe" myScript.R.R 20 "C:\Program Files\R\R-3.1.0\bin\x64\Rscript.exe" myScript.R.R 22 "C:\Program Files\R\R-3.1.0\bin\x64\Rscript.exe" myScript.R.R 23 "C:\Program Files\R\R-3.1.0\bin\x64\Rscript.exe" myScript.R.R 24 "C:\Program Files\R\R-3.1.0\bin\x64\Rscript.exe" myScript.R.R 25 "C:\Program Files\R\R-3.1.0\bin\x64\Rscript.exe" myScript.R.R 26 "C:\Program Files\R\R-3.1.0\bin\x64\Rscript.exe" myScript.R.R 27 "C:\Program Files\R\R-3.1.0\bin\x64\Rscript.exe" myScript.R.R 28 "C:\Program Files\R\R-3.1.0\bin\x64\Rscript.exe" myScript.R.R 29 "C:\Program Files\R\R-3.1.0\bin\x64\Rscript.exe" myScript.R.R 30 it pauses after running the first line only. How do I get all lines in this batch file to run sequentially? thanks [[alternative HTML version deleted]]
Ista Zahn
2015-Jan-30 15:13 UTC
[R] How to run sequential Rscript command for windows command line with a batch file.
I don't think this is an R question, since you want to loop from the windows command line rather than in R. Perhaps see http://stackoverflow.com/questions/11192039/how-to-do-a-for-loop-in-windows-command-line On Thu, Jan 29, 2015 at 11:26 PM, nevil amos <nevil.amos at gmail.com> wrote:> Hi, > > I need to run multiple iterations of a script to which I am supplying a > single numeric argument > > > I can open the command prompt window and enter a single command: > "C:\Program Files\R\R-3.1.0\bin\x64\Rscript.exe" myScript.R.R 18 > and it runs OK and saves the outputs. > Similarly if I run the same single command from a batch file it works fine > > however If I have multiple lines in the batch file eg: > > "C:\Program Files\R\R-3.1.0\bin\x64\Rscript.exe" myScript.R.R 18 > "C:\Program Files\R\R-3.1.0\bin\x64\Rscript.exe" myScript.R.R 19 > "C:\Program Files\R\R-3.1.0\bin\x64\Rscript.exe" myScript.R.R 20 > "C:\Program Files\R\R-3.1.0\bin\x64\Rscript.exe" myScript.R.R 22 > "C:\Program Files\R\R-3.1.0\bin\x64\Rscript.exe" myScript.R.R 23 > "C:\Program Files\R\R-3.1.0\bin\x64\Rscript.exe" myScript.R.R 24 > "C:\Program Files\R\R-3.1.0\bin\x64\Rscript.exe" myScript.R.R 25 > "C:\Program Files\R\R-3.1.0\bin\x64\Rscript.exe" myScript.R.R 26 > "C:\Program Files\R\R-3.1.0\bin\x64\Rscript.exe" myScript.R.R 27 > "C:\Program Files\R\R-3.1.0\bin\x64\Rscript.exe" myScript.R.R 28 > "C:\Program Files\R\R-3.1.0\bin\x64\Rscript.exe" myScript.R.R 29 > "C:\Program Files\R\R-3.1.0\bin\x64\Rscript.exe" myScript.R.R 30 > it pauses after running the first line only. > > How do I get all lines in this batch file to run sequentially? > > thanks > > [[alternative HTML version deleted]] > > ______________________________________________ > R-help at r-project.org mailing list -- To UNSUBSCRIBE and more, see > https://stat.ethz.ch/mailman/listinfo/r-help > PLEASE do read the posting guide http://www.R-project.org/posting-guide.html > and provide commented, minimal, self-contained, reproducible code.