Windows – how to send a file into clipboard from command line (CLI)

clipboardcommand-line-interfacewindows

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.

Best Answer

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.