I believe R does system calls from its current working directory (getwd() will tell you where that is). This may not be the same directory you designed your .bat for. What if you use the full path for your files in the batch file? e.g. call K:\nmvi\nmfe6 "K:\nmvi\path\control.txt" "K:\nmvi\path\output.txt" Alternatively, you could make sure R is working in the right directory. e.g. setwd('K:\nmvi')
Scott Scott Sherrill-Mix Department of Microbiology University of Pennsylvania 402B Johnson Pavilion 3610 Hamilton Walk Philadelphia, PA 19104-6076 Phone: 215-573-3141 On Wed, Aug 5, 2009 at 11:24 AM, Michal Figurski<figur...@mail.med.upenn.edu> wrote: > Hello, > > I have made an R script that prepares a NONMEM dataset and I would like to > start the NONMEM run right after the dataset is ready. > > I am using windows XP, R 2.9.1 and NONMEM 6. > > I have prepared a run.bat file that looks like this: > ---------------------------------------- > call K:\nmvi\NMdirectories.bat > > call K:\nmvi\nmfe6 "path\control.txt" "path\output.txt" > ---------------------------------------- > > The first call sets up all paths and directories, the second call starts > NONMEM. If I run this run.bat file directly in cmd window, it runs > correctly. However, if I use the R command: > shell("K:\\path\\run.bat", wait=T) > the first call runs correctly, but then the second produces and error "The > system cannot find the path specified." - completely as if the computer has > forgotten all the paths and settings from the first call. > > Does anyone know a solution to this problem? > > -- > Michal J. Figurski, PhD > HUP, Pathology & Laboratory Medicine > Biomarker Research Laboratory > 3400 Spruce St. 7 Maloney > Philadelphia, PA 19104 > tel. (215) 662-3413 > > ______________________________________________ > R-help@r-project.org mailing list > 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. > ______________________________________________ R-help@r-project.org mailing list 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.