Clip Command: Redirect Command Output to the Windows Clipboard
![Clip Command](https://configserverfirewall.s3.us-west-2.amazonaws.com/images/windows/cmd/clip/clip-command.webp)
In the Windows Command Prompt, we can use the clip
command to copy the output of other commands to the Windows clipboard.
For example, the systeminfo | clip
command sends the output of the systeminfo
to the clipboard. Once the data is on the clipboard, you can paste it onto a document or text file.
It is also possible to use the clip
command to copy the text of a file to the clipboard. For example, the following command copies the text from info.txt
to the Windows clipboard:
clip < info.txt
Examples
Copy the output of the dir command to the Windows clipboard:
dir | clip
Copy the list of open ports to the clipboard:
netstat -aon | clip
Copy the content of info.txt
to the clipboard:
clip < info.txt
You can also use the clip
command on Windows PowerShell to redirect command line output. For example, the following command copies the output of the Get-ComputerInfo
to the Windows clipboard:
Get-ComputerInfo | clip
If you want to save the output of a command, there are two ways to do it. One is to use the clip
command. The other is to redirect the output to a text file.
For example, the following command saves the output of the directory command to a text file called output.txt
:
dir > output.txt
That is all about the clip
command. It is a simple command and does not have any command switches.