tags:

views:

406

answers:

3

I see here:

http://www.pgrs.net/2008/1/11/command-line-clipboard-access

that there's a way in linux and osx to copy to the clipboard from the command line. So I ran my cygwin setup.exe, but couldn't find the xsel package. I'm guessing maybe this package hasn't been ported to windows? Looks like there's a tool to do it in windows:

http://www.labnol.org/software/tutorials/copy-dos-command-line-output-clipboard-clip-exe/2506/

I guess I'll try that - but in the mean I figured I'd ask if anyone has found a good solution.

+3  A: 

On the page you linked, there are comments hinting how to do it on windows:

On Windows, Cygwin comes with getclip and putclip which do the same job.

Andre Miller
+1  A: 

I second the answer above

To cat text to the Windows clipboard

cat ~/foo.txt | putclip

To pipe to a file whatever text is in the Windows clipboard

getclip > foo.txt

Dragos Toader
+1 for example usage.
nilamo
+2  A: 

Cygwin comes with special device file called /dev/clipboard:

echo foobar > /dev/clipboard  # Puts "foobar\n" on the clipboard
cat /dev/clipboard  # Pastes clipboard to stdout
Adam Rosenfield
this works also, but I guess I can't accept 2 different answers
andersonbd1