Output Redirection
Instead of displaying output to the screen, redirect it to files. The > and >> operators make this easy.
Save Output to a File: >
The > operator sends command output to a file. It creates the file if it doesn't exist, or overwrites it if it does.
Usage:command>filename
>
Redirect output - writes command output to a file (overwrites if exists).
Send output to file:
Command Prompt
(no list.txt file)
C:\Users\User>ls
Append to a File: >>
The >> operator appends output to a file without overwriting existing content.
Usage:command>>filename
>>
Append output - adds command output to the end of a file.
Add to existing file:
Command Prompt
First note
C:\Users\User>cat notes.txt
Redirect Echo Output
The echo command is perfect for creating files with text content.
Command Prompt
(no text files)
C:\Users\User>ls *.txt
Build Files Line by Line
Combine > and >> to build files piece by piece.
Command Prompt
C:\Users\User>ls
Knowledge Check
1 / 3What does > do?
References
These Microsoft Learn and Windows documentation links provide authoritative details for the commands used in this article.