Loading

Monday, November 16, 2009

Copy Command Line Output to Windows Clipboard Directly

Starting with Windows Vista and Windows 2003 Microsoft has finally included clip.exe.  With clip.exe you can copy items directly to the Windows clipboard from a command prompt.  XP (and earlier) users can get clip.exe from Microsoft with the Windows Server 2003 resource kit.

You can use clip with a PIPE (|) operator in your command line commands. Here are some examples:
dir /h | clip – Copy the help manual for DIR command to the clipboard
tracert powercram.com | clip – Trace the path from your computer to another website – the output is automatically copied to the clipboard and not displayed on the screen.
netstat | clip - Check if your computer is connecting to websites without your knowledge.
The clip.exe utility can also be used to copy contents of text files to clipboard directly from the command line.
clip < C:\MyFile.txt – will copy all the text from MyFile.txt to your Windows Clipboard.
Copy clip.exe help to clipboard with clip /? | 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.

No comments:

Post a Comment