I'd like to do something like this:

  • On the command line, copy a file to the Windows clipboard
  • In Windows Explorer, paste the file/files into a current location

Is there a simple tool to do this, in cygwin or elsewhere?

  • How does this fit into your wider workflow? I ask because AFAIK this isn't possible either using any Cygwin tool or the Windows command shell, and I'm wondering if there's a different way to do what you're trying to do. – me_and Feb 13 '13 at 13:48
  • 1
    Came to ask the same question. The way it fits into my workflow is: I work mostly on command line, mostly Emacs. To send a file as outlook mail attachment, I have to open explorer and copy from explorer and paste in outlook. If I can copy the "file" into clipboard on command line, I don't have to open explorer. – Miserable Variable Aug 30 '13 at 1:07

Try the clip utility that comes with Windows.


    Redirects output of command line tools to the Windows clipboard.
    This text output can then be pasted into other programs.

Parameter List:
    /?                  Displays this help message.

    DIR | CLIP          Places a copy of the current directory
                        listing into the Windows clipboard.

    CLIP < README.TXT   Places a copy of the text from readme.txt
                        on to the Windows clipboard.
| improve this answer | |
  • This won't allow the file to be pasted via windows-explorer. If you run clip < filename then Windows explorer disables paste as the clipboard only contains the file contents, not whatever an explorer copy would capture. – Adrian Pronk Feb 13 '13 at 3:54
  • @AdrianPronk Yes, sorry, good point. I misread the question. Searching, it doesn't appear that there is a good alternative for file copying that would then work with explorer. – Nicole Hamilton Feb 13 '13 at 4:32
  • 1
    In Cygwin, the canonical method to do what you're suggesting is to redirect to /dev/clipboard, rather than invoke a Windows utility program. You can also read from /dev/clipboard, which means you can use it in all sorts of exciting *nix-y pipelines and workflows. That doesn't answer the OP's question either, though! – me_and Feb 13 '13 at 13:41

I'm using this tool https://github.com/roryyorke/picellif. This is a Windows commandline tool. Put it into your PATH in Cygwin. I actually use it along with winpty like this in .bashrc

alias cf='winpty picellif'

| improve this answer | |

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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