Take the 2-minute tour ×
Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

I'd like to do something like

dir *.* > clipboard

ie. get to get the standard output of a command line program copied to the clipboard. Can this be done on a standard XP machine without additional programs?

share|improve this question
4  
Just for the archives: the Mac OS X equivalents are called pbcopy and pbpaste. –  Arjan Jan 19 '10 at 12:45
    
superuser.com/questions/231023/… mentions petri.co.il/software/clip.zip which is apparently on windows server 2003 or the 2003 resource kit maybe. But there it is for download –  barlop Sep 10 '13 at 14:55
add comment

6 Answers

up vote 15 down vote accepted

I don't believe so - Vista (or NT4) introduced the clip tool, which would do your command as dir | clip - but there's nothing on XP. If you're willing to use 3rd party applications, though, there's this, which works as above, except is called cb, not clip.

share|improve this answer
2  
as a historical note, Arjan's link to the MS support note references NT4. but you're probably right that consumer versions of Windows didn't include clip.exe before Vista. –  quack quixote Jan 19 '10 at 13:47
    
Oh, fair enough. Never really get a chance to mess around on business machines! :( –  Phoshi Jan 19 '10 at 15:42
    
if it's any consolation, i completely missed out on all the fun of Windows NT 3.51. and i wasn't a fan of NT at all until i got to play with 2000 for a while. –  quack quixote Jan 19 '10 at 15:45
add comment

For Windows and non-Windows, this post says it all:

On Windows, try: echo hello | clip

On Linux, try: echo hello | xclip

On Mac OS X, try: echo hello | pbcopy

For example, you might do (cat myFile.txt | xclip). This would basically allow you to edit the clipboard directly.

(I came here via Google looking for the Mac equivalent of xclip)

share|improve this answer
add comment

There's no standard way, but you can apparently use clip.exe which came with the Windows Server 2003 resource kit . Source

The problem now becomes getting hold of a legal copy of this.

share|improve this answer
    
I wonder how legal that is. What sort of licensing do MS put their small cli tools under, I wonder? –  Phoshi Jan 19 '10 at 12:42
1  
It was also available in the NT 4 and Server 2000 Resource kit if you have either of those available to you. It does not seem to be available in the now free-to-download subset of the 2000 RK tools. –  AdamV Jan 19 '10 at 15:27
add comment

I looked into this for myself earlier today. Below is something helpful to those wanting to insert and retrieve information from the clipboard in a linux distribution. Below that is something that could prove helpful for those with windows.

Linux

By default, xclip uses the "primary" clipboard, which is what you have copied with your mouse. To get it to use the manual copy clipboard, use xclip -sel clip instead.

comment #3 here:
http://ubuntuforums.org/showthread.php?t=413786

Windows

The functionality is available in Active Perl distribution also, which is what I wound up using on the windows box in this exercise; The windows clip.exe didn't appear to allow for reading the data from the clipboard (only writing into clipboard).

http://www.xav.com/perl/site/lib/Win32/Clipboard.html

share|improve this answer
    
Since you've mentioned perl, I would like to add that ruby and python provide similar library too. –  weakish Sep 30 '12 at 11:33
add comment

Windows users can get gclip.exe as part of a big bundle of tools, which allows you to do just this.

share|improve this answer
add comment

In PowerShell, it can be done like this:

dir *.* | clip
share|improve this answer
1  
As an aside: see "Clip.exe Not Compatible with Notepad" at support.microsoft.com/kb/172596 –  Arjan Jan 19 '10 at 12:44
1  
That link isn't relevant to PowerShell. I've tested it and everything works fine with Notepad. –  Mark Jan 19 '10 at 12:48
    
I can confirm that this works on XP, IF a Server 2003 clip.exe is in you path. Also works in a standard CMD prompt –  Shevek Jan 19 '10 at 12:54
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.