Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

cygwin command to copy to windows clipboard

Tags:

cygwin

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.

like image 581
andersonbd1 Avatar asked Aug 24 '09 13:08

andersonbd1


People also ask

How do you copy and paste in Cygwin?

So, the solution is very simple: Click on Cygwin Window Bar -> Options -> Mouse -> Click actions -> Select Paste radio button. Click Apply + Save and close the window. You are Done now, Test & Check!

How do I copy from clipboard to command prompt?

Now you can select text using your mouse or the keyboard (hold down the Shift key and use the left or right arrows to select words). Press CTRL + C to copy it, and press CTRL + V to paste it in the window. You can also easily paste text you've copied from another program into the command prompt using the same shortcut.


1 Answers

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 
like image 75
Adam Rosenfield Avatar answered Oct 03 '22 17:10

Adam Rosenfield