Computer Hope

Microsoft => Microsoft DOS => Topic started by: wyq on January 05, 2005, 04:59:07 AM

Title: Help-what does "2>&1" mean?
Post by: wyq on January 05, 2005, 04:59:07 AM
Hey,I am now working on a wince project. I often encounter "2>&1" in batch file.
It often looks like this:
@REM // cleanup error log file and set local env
if not "%___BATCHMODE%"=="" goto endif_25
   setlocal
   del %_WINCEROOT%\build.err > nul 2>&1
   del %_WINCEROOT%\build.log > nul 2>&1
   del %_WINCEROOT%\build.wrn > nul 2>&1
:endif_25

I know:
2>:redirects error output of a program to a file.
&:separates two or more commands executed sequentially.

But I do not know what does "2>&1" mean?
Please help!
Thanks in advance.
Title: Re: Help-what does "2>&1" mean?
Post by: Dusty on January 06, 2005, 01:03:19 AM
Looks like an instruction in OS/2 and NT to route standard output & command error to a file (in this case the file NUL) - see here

http://www.robvanderwoude.com/index.html

Sorry I can't be of more help but the website is pretty clear.

Good luck