DOS has three I/O streams: one input stream (stdin), and two output streams (stdout and stderr).
Each stream has a number:
DOS has 6 redirect operators to send output to a stream (other than the console window), and receive input from a stream (other than the keyboard):
Example: read input from commands.txt, send to cmd.exe as input.
commands.txt
Example: read input from list.txt, send to sort.exe as input.
list.txt
Example:
Example: send stdout (1) to output.html, and stderr (2) to errors.txt.
Example: send stdout (1) to the nul device.
Example:
Example: if we run the console application reg.exe with no parameters (or bad parameters), we will still see an error message in the console window, even with stdout redirected to the file out.txt, which will be empty:
list.txt
Example: put the hostname on the clipboard