Sometimes it is useful to get the output of a command and paste it to a text editor. For this we can use piping and the clip (i.e. sends the output to Windows clipboard) command.
Example:
If we go to any directory and run the tree command but it returns a very long output that exceeds the screen. We can redirect the output to Windows clipboard temporarily then paste it to a text editor.
- Open a command terminal.
- Try to run the following tree command.
%USERPROFILE%>tree
Where %USERPROFILE% is normally resolves to our local home directory.
The output might not fit to command terminal screen.
- Try redirecting it to a Windows clipboard with the following command:
%USERPROFILE%>tree | clip
You will see no output because it is directed to a Windows clipboard.
- Open a text editor of our choice (or anything where we wanted to paste the output).
Check if you can confirm the last entries from step 2 exists to our pasted output.
Leave a Reply