Save STDOUT/STDERR to clipboard (and more)
Summary: How to redirect the STDOUT or STDERR stream to clipboard.
Note to self (mostly), in case I forget the command that would redirect standard output or standard error stream and save it on the clipboard.Redirect STDOUT to clipboard:
command | clipRedirect STDERR to clipboard:
command 2>&1 | clipThe following will save the contents of the current directory to the clipboard:
dir | clipNow, let's try the following:
dir xyz: | clipThe clipboard now will hold something like this:
Volume in drive C is SYSTEM Volume Serial Number is 1234-ABCD Directory of C:\Windows\SysWOW64Now, let's redirect STDERR to clipboard:
dir xyz:2>&1 | clipThe clipboard now will hold something like this:
"xyz:" is not a recognized device. "xyz:" is not a recognized device. Volume in drive C is SYSTEM Volume Serial Number is 1234-ABCD Directory of C:\Windows\SysWOW64 File Not FoundSee also:
Forgotten (but Awesome) Windows Command Prompt Features by Scott Hanselman
How to pipe stderr, and not stdout?