By default, when you execute a command, the input comes from the keyboard and the output is sent to the Command Prompt window. Command inputs and outputs are called command handles.

Redirection Operators in Windows and MS-DOS

The table below lists all the available redirection operators for commands in Windows and MS-DOS. However, the > and » redirection operators are, by a considerable margin, the most commonly used. The clip command is worth mentioning here as well. It’s not a redirection operator but it is intended to be used with one, usually the vertical pipe, to redirect the output of the command before the pipe to the Windows clipboard. For example, executing ping 192.168.1.1 | clip will copy the results of the ping command to the clipboard, which you can then paste into any program.

How to Use a Redirection Operator

The redirection operator is added after the normal command is written. The ipconfig command is a common way to find various network settings through Command Prompt. One way to execute it is by entering ipconfig /all in the Command Prompt window. When you do that, the results are displayed within Command Prompt and are then only useful elsewhere if you copy them from the Command Prompt screen. That is unless you use a redirection operator to redirect the results to a different place like a file.

Ipconfig Command Redirection Operator

If we look at the first redirection operator in the table above, we can see that the greater-than sign can be used to send the command’s results to a file. This example command above is how you’d send the results of ipconfig /all to a text file called networksettings.txt.

Dir Command Redirection Operator

The dir command is another situation where a redirection operator is really useful. Since that command often produces results too long to read comfortably in a Command Prompt window, exporting all of it to a text document is wise. In that example, all files and folders in that user’s Downloads folder will be shown in the downloads.txt file.