<p>A redirection operator is a special character that can be used with a <a href="https://www.lifewire.com/what-is-a-command-2625828" data-component="link" data-source="inlineLink" data-type="internalLink" data-ordinal="1">command</a>, like a <a href="https://www.lifewire.com/list-of-command-prompt-commands-4092302" data-component="link" data-source="inlineLink" data-type="internalLink" data-ordinal="2">Command Prompt command</a> or <a href="https://www.lifewire.com/dos-commands-4070427" data-component="link" data-source="inlineLink" data-type="internalLink" data-ordinal="3">DOS command</a>, to either redirect the input to the command or the output from the command.</p><p>By default, when you execute a command, the input comes from the <a href="https://www.lifewire.com/what-is-a-keyboard-2618153" data-component="link" data-source="inlineLink" data-type="internalLink" data-ordinal="4">keyboard</a> and the output is sent to the <a href="https://www.lifewire.com/command-prompt-2625840" data-component="link" data-source="inlineLink" data-type="internalLink" data-ordinal="5">Command Prompt</a> window. Command inputs and outputs are called command handles.</p><h3>Redirection Operators in Windows and MS-DOS</h3><p>The table below lists all of the available redirection operators for commands in Windows and MS-DOS. However, the <strong>&gt;</strong> and <strong>&gt;&gt;</strong> redirection operators are, by a considerable margin, the most commonly used.</p><table border="1" cellpadding="2" cellspacing="0"><tbody><tr><th>Redirection Operator</th><th>Explanation</th><th>Example</th></tr><tr><td><strong>&gt;</strong></td><td>The greater-than sign is used to send to a file, or even a printer or other device, whatever information from the command would have been displayed in the Command Prompt window had you not used the operator.</td><td><strong>assoc &gt; types.txt</strong></td></tr><tr><td><strong>&gt;&gt;</strong></td><td>The double greater-than sign works just like the single greater-than sign but the information is appended to the end of the file instead of overwriting it.</td><td><strong>ipconfig &gt;&gt; netdata.txt</strong></td></tr><tr><td><strong>&lt;</strong></td><td>The less-than sign is used to read the input for a command from a file instead of from the keyboard.</td><td><strong>sort &lt; data.txt</strong></td></tr><tr><td><strong>|</strong></td><td>The vertical pipe is used to read the output from one command and use if for the input of another.</td><td><strong>dir | sort</strong></td></tr></tbody></table><p><strong>Note:</strong> Two other redirection operators, <strong>&gt;&amp;</strong> and <strong>&lt;&amp;</strong>, also exist but deal mostly with more complicated redirection involving command handles.</p><p><strong>Tip:</strong> The clip command is worth mentioning here as well. It&#39;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.</p><p>For example, executing <strong>ping 192.168.1.1 | clip</strong> will copy the results of the <a href="https://www.lifewire.com/ping-command-2618099" data-component="link" data-source="inlineLink" data-type="internalLink" data-ordinal="6">ping command</a> to the clipboard, which you can then paste into any program.</p><h3>How to Use a Redirection Operator</h3><p>The <em>ipconfig </em>command is a common way to find various network settings through Command Prompt. One way to execute it is by entering <em>ipconfig /all </em>in the Command Prompt window.</p><p>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.</p><p>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&#39;s results to a file. This is how you&#39;d send the results of <em>ipconfig /all</em> to a text file called <em>networksettings</em>:</p><pre> <strong>ipconfig /all &gt; networksettings.txt</strong></pre><p>See <a href="https://www.lifewire.com/how-to-redirect-command-output-to-a-file-2618084" data-component="link" data-source="inlineLink" data-type="internalLink" data-ordinal="7">How to Redirect Command Output to a File</a> for more examples and detailed instructions on using these operators.</p>