Logo: TechTrax...brought to you by MouseTrax Computing Solutions

Copying Data to the Clipboard from a Command Prompt using CLIP.EXE

by David Horowitz

This article is protected by Copyscape! DO NOT COPY without permission!

Skill rating level 3.

Here’s a quick tip for readers who like to work in the Command Prompt.

Have you ever wanted a convenient way to copy data to the Clipboard from the command window without using Edit > Mark from the Command Prompt's system menu or using the mouse selection method? There is a little tool in Windows that will do this for you easily. It comes prepackaged with Windows Vista and Windows Server 2003, and is an easy download for Windows XP. It’s a command-line tool called CLIP.EXE.

Using CLIP.EXE

If you're working on Windows Vista or Windows Server 2003, then you already have everything you need. If you're working on Windows XP, then you'll need to get CLIP.EXE by following the instructions later in this article.

For how to use CLIP.EXE, let’s let Microsoft do the talking, by typing CLIP /? at the command line:

C:\>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.

Basically, to place the output of any command onto the Clipboard, you "pipe" it to CLIP. To "pipe to CLIP" means to append "| CLIP" to the end of the command line. (The pipe character ("|") is entered by pressing Shift-\ (backslash) on US keyboards.)

So you might use any of the following commands:

DIR | CLIP
CD | CLIP
DIR *.doc | CLIP
DIR /B | CLIP
TIME /T | CLIP
DATE /T | CLIP
TYPE readme.txt | CLIP

Or, if you’d like to place the contents of a text file onto the Clipboard, you can use:

CLIP < readme.txt
CLIP < autoexec.bat
CLIP < email.msg

Once the data is on the Clipboard, you can paste it into most programs using Edit > Paste, or by simply pressing Ctrl-V.

Getting CLIP.EXE for Windows XP

Daniel Petri, an IT expert and Microsoft Most Valuable Professional (MVP) from Israel, has a copy of CLIP.EXE on his web site at:

http://www.petri.co.il/software/clip.zip

You should place CLIP.EXE (which is the single file contained in the ZIP) into your C:\windows\system32 folder, or into some other folder which is in your path. You can also copy the CLIP.EXE file from a Windows Server 2003 system. (Please check into your own licensing issues.) I’ve heard reports that the Vista version will not work if copied to Windows XP.

Click to rate this article.

Go up to the top of this page.
This site powered by the Logical Web Publisher™: Content management by Logical Expressions, Inc.