blank.gif (43 bytes)

Church Of The
Swimming Elephant

Search:
index.gif

ntcmds00000000.gif

Redirection

Redirection characters change where a command gets information from or sends information to.

Redirecting Command Input and Output

Unless you specify otherwise, Windows NT receives input from your keyboard and sends output to your screen. Sometimes it is useful to redirect the input or output to a file or a printer. For example, you might want to redirect a directory listing from the screen to a file.

To redirect the input or output of a command, you use one of the following redirection characters:

ntcmds00000002.gif The greater-than sign (>) sends the output of a command to a file or a device, such as a printer.

ntcmds00000002.gif The less-than sign (<) takes the input needed for a command from a file rather than from the keyboard.

ntcmds00000002.gif The double greater-than sign (>>) adds output from a command to the end of a file without deleting the information already in the file.

Redirecting the Output of a Command

Almost all commands send output to your screen. Even commands that send output to a drive or printer also display messages and prompts on your screen.

To redirect the output from the screen to a file or printer, use the greater-than sign (>). You can use the greater-than sign with most Windows NT commands. For example, in the following command, the directory listing produced by the dir command is redirected to the DIRLIST.TXT file:

dir > dirlist.txt

If the DIRLIST.TXT file doesn't exist, Windows NT creates it. If DIRLIST.TXT exists, Windows NT replaces the information in the file with the output from the dir command.

To add the output from a command to the end of a file without losing any of the information already in the file, use a double greater-than sign (>>). For example, in the following command, the directory listing produced by the dir command is appended to the DIRLIST.TXT file:

dir >> dirlist.txt

Note

ntcmds00000002.gif Some command output, such as error messages, may not be redirected when using the greater-than sign (>).

Redirecting the Input to a Command

Just as you can send the output of a command to a file or printer rather than to your screen, you can take the input for a command from a file rather than from the keyboard. To take input from a file, use the less-than sign (<). For example, the following command takes the input for the sort command from the LIST.TXT file:

sort < list.txt

Windows NT alphabetizes the lines of the LIST.TXT file and displays the result on your screen.

Cotse.Net

Protect yourself from cyberstalkers, identity thieves, and those who would snoop on you.
Stop spam from invading your inbox without losing the mail you want. We give you more control over your e-mail than any other service.
Block popups, ads, and malicious scripts while you surf the net through our anonymous proxies.
Participate in Usenet, host your web files, easily send anonymous messages, and more, much more.
All private, all encrypted, all secure, all in an easy to use service, and all for only $5.95 a month!

Service Details

 
.
www.cotse.com
Have you gone to church today?
.
All pages ©1999, 2000, 2001, 2002, 2003 Church of the Swimming Elephant unless otherwise stated
Church of the Swimming Elephant©1999, 2000, 2001, 2002, 2003 Cotse.com.
Cotse.com is a wholly owned subsidiary of Packetderm, LLC.

Packetderm, LLC
210 Park Ave #308
Worcester, MA 01609