DonationCoder.com forum
 
Read-only archive. This is a static copy of the DonationCoder.com forum. Reading and searching work as before; logging in, posting and private messages do not.
Archive of 2026-10-21 · About this archive · Main site

Author Topic: How to Copy the Command Output to Windows Clipboard - and to CHS  (Read 7,833 times)

IainB

  • @Slartibartfarst
  • Supporting Member
  • Joined in 2008
  • **
  • Posts: 7,544
Apologies for any duplication if this has already been posted in DCF.

Nifty tip from Labnol.org: How to Copy the Command Output to Windows Clipboard

Just use the Pipe (|) and "clip"

Example:
Typing dir | clip at the Command prompt puts the directory list into the Clipboard, or directly into CHS (Clipboard Help & Spell) if you are using it.
« Last Edit: August 11, 2013, 09:31 AM by IainB »

Winkie

  • Supporting Member
  • Joined in 2008
  • **
  • Posts: 94
    • Participated in NANY Challenge Once
Re: How to Copy the Command Output to Windows Clipboard - and to CHS
« Reply #1 on: August 11, 2013, 12:09 PM »

Note that the clip command isn't available on Windows XP and earlier versions op Windows by default. See here for more information and instructions how to obtain the functionality if  your system does not have it.

x16wda

  • what am I doing in this handbasket?
  • Supporting Member
  • Joined in 2007
  • **
  • Posts: 888
    • Participated in NANY Challenge Once
Re: How to Copy the Command Output to Windows Clipboard - and to CHS
« Reply #2 on: August 11, 2013, 08:40 PM »
There is another utility called cb.exe that does the same thing, though I'm not sure what source I got it from.  But you can also use winclip.exe to push stdin to the clipboard, or pull the clipboard contents into a file (or just to the cmd window if you want to see what's in there).
vi vi vi - editor of the beast

4wd

  • Pedantic Old Bastard
  • Supporting Member
  • Joined in 2006
  • **
  • Posts: 5,652
    • Coding Snacks
Re: How to Copy the Command Output to Windows Clipboard - and to CHS
« Reply #3 on: August 12, 2013, 03:01 AM »
There is another utility called cb.exe that does the same thing, though I'm not sure what source I got it from.

You can download cb.exe from the AutoHotkey FAQ: Download link
"I will not follow where the path may lead, but I will go where there is no path, and I will leave a trail." - Muriel Strode, 1903

lanux128

  • Global Moderator
  • Joined in 2005
  • *****
  • Posts: 6,277
    • Coding Snacks
    • Volunteers/Staff
    • Gathering Badge
    • Participated in NANY Challenge Once
    • Linux User
Re: How to Copy the Command Output to Windows Clipboard - and to CHS
« Reply #4 on: August 12, 2013, 04:11 AM »
i use ClipCopy which was written by a fellow DoCo member, ChalkTrauma.

Usage
* This will copy the output from dir /b to clipboard
dir /b | clipcopy

* This will do the same but echo out to stdout at the same time ( like tee )
dir /b | clipcopy -e

* This will dump the text contents of the clipboard to stdout
clipcopy -g

* So you can dump the clipboard contents to a file like this
clipcopy -g > clipboard.txt

* You can also put strings directly on the clipboard like this
clipcopy this is going to the clipboard

Well, that is about all it does, you can type clipcopy -h for usage..

DL: http://www.dreamcycle.net/download/?ClipCopy.exe
Source: https://www.donationcoder.com/forum/index.php?topic=15720.msg138125#msg138125

Original address: https://www.donationcoder.com/forum/index.php?topic=35739.0