Reputation: 5396
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.
Upvotes: 90
Views: 31544
Reputation: 141
what about just
clip < file.extension
just tried in on my ssh key
Upvotes: 13
Reputation: 21
Not exactly Ditto, but here's a clibboard logger.
#!/usr/bin/ksh
while true
do
if [[ "$(</dev/clipboard)" = "${LastClip}" ]]
then
sleep 2
else
LastClip="$(</dev/clipboard)"
echo "$(</dev/clipboard)" >> $HOME/cliplog.txt
sleep 1
fi
done
Upvotes: 2
Reputation:
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
Upvotes: 28
Reputation: 5430
Actually google "resource kit clip " for your windows clip and in cygwin terminal ( I use puttycyg works the following: find | clip
Upvotes: 2
Reputation: 400384
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
Upvotes: 183
Reputation: 15493
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.
Upvotes: 68