8

I expect something simple like "put2clip c:\boot.ini" which would result in the same thing as right-clicking in explorer the boot.ini file and select 'copy'.

i looked at nirsoft's nircmd, thinkingms.com/pensieve/2009/03/14/ClipexeACommandLineToolForTheWindowsClipboard.aspx and steve.org.uk/Software/clipboard/ bot none of them seems to do the work or provide good documentation.

thanks.

grufftech
  • 6,620
  • 4
  • 35
  • 37
user48831
  • 99
  • 1
  • 1
  • 2
  • 1
    update: I've received an email from Roshan James author of alternate clip.exe but the procedure and syntax is quite a pain: cd myfolder first, then clip files filename.exe copy – user48831 Jul 22 '10 at 07:03

2 Answers2

18

You don't specify which flavour of Windows, but anything from Vista/2003 onwards should work doing this:

echo blah | clip

or

type myTextFile.txt | clip

However, I am not aware of a way to put an object (like a file (jpg, mp3, ini, etc)) into the clipboard from the command line using native tools.

Izzy
  • 8,214
  • 2
  • 30
  • 35
  • Works, but not for all character sets. I was trying to get ¯\_(ツ)_/¯ into a file so I could quickly get it to my clipboard, but `type shruggie.txt` produces ┬»\_(πâä)_/┬» I don't know what the rant above is about ... ¯\_(ツ)_/¯ – MayTheSForceBeWithYou Nov 09 '18 at 17:41
  • @MayTheSForceBeWithYou Does this help? https://stackoverflow.com/a/48029600/159145 (interestingly, also using the exact same emoticon as your comment...) – Dai Apr 13 '22 at 03:52
2

"simple command line tool to copy file into windows clipboard" See: https://github.com/rostok/file2clip

It includes source.

Luuk
  • 152
  • 4