| 224 |
| Use the command line to redirect input and output |
| As the computer industry continues to advance, and as users rely more on Windows applications, |
| users will become less familiar with basic command line concepts. However, certain concepts, such |
| as input and output redirection, are very useful. |
| For example, assume you want to display a directory listing with DIR, but you want to save the |
| results to a text file that you can edit with Notepad to create a batch file or script. You can redirect |
| the output of the DIR command to a text file with the greater than character [>]: |
| This command makes DIR redirect the output to Myfile.txt. If the file exists, its contents are |
| To append the output to the end of the file, rather than overwrite it, use two greater than characters |
| Assume you want to sort the contents of a text file and display it to the screen; the SORT command |
| can take keyboard input, or you can redirect the input from your text file: |
| You also can combine input and output redirection. This example directs input from Myfile.txt to |
| the SORT command and directs the output to a new file named Sorted.txt: |
| SORT < Myfile.txt > Sorted.txt |
First Previous Next Last |