[R] capture stderr in Windows

Prof Brian Ripley ripley at stats.ox.ac.uk
Mon Aug 16 20:45:27 CEST 2004


On Mon, 16 Aug 2004, Duncan Murdoch wrote:

> The CMD.EXE shell in Win XP (and 2K?) allows redirection of stderr in
> the usual Unix style:

(Yes, all NT-based versions of Windows.)

>   Rterm --no-save --no-restore < "Rscriptfile" > "Rstdoutfile"
> 2>"Rstderrfile"
> 
> You can also use "2>&1" to redirect stderr into the stdout stream, so
> both go to Rstdoutfile.

[But the order matters, so first redirect stdout and then redirect stderr 
to stdout.]

And for completeness, 

1) Under non-NT Windows (95/98/ME) stderr is the same as stdout since its 
shells don't know about stderr.

2) This is in all the rw-FAQ, Q2.10

-- 
Brian D. Ripley,                  ripley at stats.ox.ac.uk
Professor of Applied Statistics,  http://www.stats.ox.ac.uk/~ripley/
University of Oxford,             Tel:  +44 1865 272861 (self)
1 South Parks Road,                     +44 1865 272866 (PA)
Oxford OX1 3TG, UK                Fax:  +44 1865 272595




More information about the R-help mailing list