Redirection
Directing output ( > ) from a program to a specific file or device (different from the 'standard output' device: the screen).
Directing input ( < ) to a program from a specific file or device (different from the 'standard input' device: the keyboard).
Pipe
A data-channel ( | ) in RAM that takes output from a program and feeds the data as input to another program.
Filter
A program that accepts input data - does something to the data - and delivers output data.
Both input and output may be redirected or piped.
DOS filters: find, more, sort
Examples:
dir > list.txt
redirect output from dir to the file list.txt
- if the file does not exist, it is created
- if the file exists, it is overwritten.
dir >> list.txt
redirect and append output from dir to the file list.txt
- if the file does not exist, it is created
- if the file exists, output is appended to end of file.
sort < names.txt > list.txt
use the file names.txt as input to sort.
output from sort is sent to the file list.txt.
dir | sort
pipe output from dir to sort.
output from sort is sent to standard output: the screen.
dir | sort > c:\temp\list.txt
output from sort is sent to the file c:\temp\list.txt
dir | sort | more
output from sort is piped to more.
more (a filter) delivers output one screenfull at a time.
Redirection and pipes may be used in batch files.
Source:
http://www.uv.tietgen.dk/staff/mlha/PC/Soft/DOS/com/
See also:
http://gatsby.tafe.tas.edu.au/batch/