Share on Facebook Share on Twitter Email
Answers.com

DOS redirection

 

Redirecting keyboard input and screen output (see DOS Mode to redirect the printer port). Normally, DOS gets input from the keyboard and displays output on screen. However, you can redirect input from the keyboard to another file and redirect output from the screen to the printer or a disk file. The symbols are:

   <   Redirect input
   >   Redirect output to a new file
   >>  Redirect output to an existing file

For example, to redirect the output of a Dir list to the printer, type:

                 dir > prn

PRN is the name of the parallel port (see DOS device names).

The following example redirects input to sort a text file named FIRST into alphabetical order and display it on screen:

               sort < first

Using both input and output redirection, the sorted file can be copied into a new file called SECOND. Think of < as "input from," and > as "output to."

            sort < first > second

Redirection can be used with the Pipe command, which funnels output of one command into another. The following example, using the pipe's vertical bar symbol, funnels output of the Dir list to the Sort filter before redirecting it to a disk file called NEWLIST:

            dir | sort > newlist

Since the pipe and redirection symbols act as word separators, you could type the above command as:

            dir|sort>newlist

See DOS Sort.

Download Computer Desktop Encyclopedia to your iPhone/iTouch

Search unanswered questions...
Enter a question here...
Search: All sources Community Q&A Reference topics
 
 

 

Copyrights:

Computer Desktop Encyclopedia. THIS DEFINITION IS FOR PERSONAL USE ONLY.
All other reproduction is strictly prohibited without permission from the publisher.
© 1981-2010 The Computer Language Company Inc.  All rights reserved.  Read more