what is the meaning of 1nul or 2nul

May 19, 2009 at 03:33:32
Specs: Windows XP
What is the meaning of 1>nul or 2>nul etc?

What is the significance of that integer(1 or 2 or 3) in the expression?

See More: what is the meaning of 1nul or 2nul

Report •

May 19, 2009 at 05:07:39
0 = standard input - normally keyboard.
1 = standard output - normally console.
2 = standard error - normally console.
3 - 9 = generally not used/reserved/program specific.

Specifying the number tells the command processor where you want the output to go. Standard input and output are assumed when directing unless the number is assumed, so "echo text > file" assumes that the standard output will be redirected to file, this is essentially "echo text 1> file".

It is possible to redirect standard output to standard error or visa-versa.

1>&2 echo This is going to standard error!
2>&1 echo This is going to standard output, but so will any errors!

Nul is a special system object that basically takes input but does nothing with it (ever met a person that just loses everthing??) , so redirecting to nul gets rid of unwanted output.

Report •
Related Solutions

Ask Question