| Login

Search this Blog


Links I like to keep around




Here are the most recent postings to this blog. Use the archive calendar or search to find other entries.
Jun18

Written by:R Teachout
6/18/2007 2:03 PM

This really isn't a script, just a great tool I ran across, built into W2K3/Vista (works on XP if you can just copy that file over)

Source: http://weblogs.asp.net/owscott/archive/2006/12/15/clip-saving-command-line-and-powershell-output-directly-to-the-clipboard.aspx  Archived here for records

Clip - Saving command line and powershell output directly to the clipboard

Every once in a while I run across something so simple, yet so powerful, that I wonder why I've never heard of it before.  Today I came across one of those situations.

Within Windows Server 2003 and Vista, there is a command line and PowerShell parameter called "Clip".  This allows you to output the command line results directly to the clipboard.  This is great if you need to output a large result, or even if you want to save the hassle of selecting text and copying to the clipboard when you could have done it in a single step.

It's very simple, just pipe (|) to the CLIP command.

For example, let's say I want to get a list of all IP addresses on a Windows Server 2003 box. (the server has dozens of IP addresses)  In the past I would often pipe the results to a text file and then open the text file and save the results to the clipboard.  Not anymore!  The command would be like this:

ipconfig /all | clip

Now I have the detailed ipconfig in my clipboard to be pasted wherever I want.  This works with large files and large output too.  Be careful of course that you don't try to CLIP a 1000MB file! 

Here's the help for clip:

CLIP

Description:
    Redirects output of command line tools to the Windows clipboard.
    This text output can then be pasted into other programs.

Parameter List:
    /?                  Displays this help message.

Examples:
    DIR | CLIP          Places a copy of the current directory
                        listing into the Windows clipboard.

    CLIP < README.TXT   Places a copy of the text from readme.txt
                        on to the Windows clipboard.

And yes, I used CLIP to capture that help information, like so: clip /? | clip

What about Windows XP users?  CLIP was not included in Windows XP but you can get it easily enough.  If you have access to a Vista or Windows Server 2003 computer, just copy the clip.exe file from C:\%windir%\system32 folder to your system32 folder.  It will immediately work as expected.

Tags:

I think the most thoughtful feature in Windows is the blue screen. Such a nice, soothing color, just when I need soothing the most. Now if only it could play that mellow newage startup music during hard hangs.
-Unknown

Inspired by Nina