Reader Tip: Redirecting shell output to the clipboard

by Bharat Suneja

Exchangepedia reader Guamaniac has an interesting tip in the comments on “Exchange 2007 Content Filter: The Whitelist Is Here!“:

Get-ContentFilterConfig should give you a list of all the content filter settings on that particular Transport server.

And I know this is the simplest of features in PowerShell, but I just love the fact that you can pipe output to the clipboard:

get-contentfilterconfig | clip

and then peruse in your favorite text editor!

I’m used to simply highlighting the output using the mouse (which adds it to the clipboard). You need to enable QuickEdit on the command prompt window to be able to use this cut-and-paste functionality..

{ 2 comments… read them below or add one }

$hay@Israel December 25, 2007 at 12:46 am

FYI, there is no built-in cmdlet in PowerShell to redirect text to the clipboard. The suggested tip is probably using a custom exe file (clip) to copy the get-contentfilterconfig to the clipboard. One thing though, PowerShell Community Extensions (PSCX) do have a cmdlet called “Out-Clipboard”. You can download PSCX at: http://www.codeplex.com/PowerShellCX.

Reply

Bharat Suneja December 26, 2007 at 9:07 am

– Afaik, it doesn’t use any custom code or EXE. (Works “out-of-the-box”.)
– It redirects the entire output from the command to the clipboard, similar to the known method of redirecting command output to a file (from DOS days) using:
COMMAND-NAME > mytextfile.txt

Reply

Leave a Comment

Previous post:

Next post: