nul is an empty device name, like a black hole.
> means to overwrite the output.
1 is the output stream, 2 is the error stream (1 can be omitted without writing).
>nul 2>nul means to not output the output information and error information of the command execution to the screen, but to an equipment that does not exist at all.
Common device names:
con console (keyboard and display)
aux, com1 - com4 all serial ports
prn, lpt1 - lpt3 all parallel ports
nul empty device
clock$ electronic clock
Can be referenced when writing commands, and files cannot be named with these names.
Redirection operators
> Write the command output to a file or device instead of writing it in the command prompt window.
< Read command input from a file instead of from the keyboard.
>> Add the command output to the end of the file without deleting the information in the file.
>& Write the output of one handle to the input of another handle.
<& Read input from one handle and write it to the output of another handle.
| Read output from one command and write it to the input of another command. Also called a pipeline.
0 input
1 output
2 error output
3-9 are individually defined by applications and various specific tools.
Diskette Operating System