Re-Post from: http://www.j2eeblogs.blogspot.com/2007/07/nul-2.html
Saturday, July 14, 2007
>nul 2>&1
Listen to the article >nul 2>&1 as MP3
This was a truth that i didn't know whats the string >nul 2>&1 means in batch scripting , even though i used it in many batch scripts :-) . Thanks to Dark for explaining it in the MSFN blog.
It redirects standard output, STDOUT, (1>nul), and standard error, STDERR, (2>nul), to nul.
STDOUT, channel 1, is the default therefore doesn't require the channel number stipulating, (>nul).
You can use
>nul 2>nul
which will redirect each channel to its own nul
Or you can use
>nul 2>&1
which redirects STDERR to the same nul as the STDOUT channel.
As for the (&), (&&)
& separates multiple commands on one command line.
&& causes the command following this symbol to run if the command preceding the symbol is successful.
No comments:
Post a Comment
Welcome, Gregory Wiktor - ADCOM Corp.