cygwin command to copy to windows clipboard

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

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.


I second the answer above

To cat text to the Windows clipboard

putclip < foo.txt

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

getclip > foo.txt

getclip/putclip is found in cygutils-extra package.