![[Toc]](../../toc.gif)
![[Index]](/idx.gif)
Redirect STDOUT and STDERR
If you want to redirect STDOUT and STDERR of an OS/2 command, you should
always redirect STDERR first. If, instead, the reverse of this is used,
some programs (including CMD.EXE) sometimes write their error messages to
the display regardless of the redirection of STDERR.
To redirect STDOUT and STDERR into the same FILE use the following
construct:
"attrib a:test.cmd 2>>errFile 1>>&2"
To redirect STDOUT and STDERR into the same PIPE use the following
construct:
"attrib a:test.cmd 2>&1 | pipeit.cmd"
Please note that other command line interpreter, such as 4OS2, for
instance, may use another syntax for the redirection of STDOUT and/or
STDERR.
Note: See also STDOUT / STDERR, How to check if STDIN, STDOUT or STDERR
are redirected to a file see General input line enhancer for an
example use of STDERR and STDOUT.
Created using Inf-PHP v.2 (c) 2003 Yuri Prokushev
Created using Inf-HTML v.0.9b (c) 1995 Peter Childs