Sunday, June 23, 2013

How to Send the Contents of the Clipboard to a Text File via the Send to Menu

image

We have previously covered how to send the contents of a text file to the Windows Clipboard with a simple Sent To shortcut, but what if you want to do the opposite? That is: send the contents of the clipboard to a text file with a simple shortcut.
No problem. Here’s how.

Copy the ClipOut Utility

While Windows offers the command line tool ‘clip’ as a way to direct console output to the clipboard, it does not have a tool to direct the clipboard contents to the console. To do this, we are going to use a small utility named ClipOut (download link at the bottom).
Simply download and extract this file to a location in your Windows PATH variable (if you don’t know what this means, just extract the EXE to your C:\Windows folder) and you are ready to go.

Add the Send To Shortcut

Open your Send To folder location by going to Run > shell:sendto
Create a new shortcut with the command:
CMD /C ClipOut >
Note the above command will overwrite the contents of the selected file. If you would like to append to the contents of the selected file, use this command instead:
CMD /C ClipOut >>
Of course, you could make shortcuts for both.
Give a descriptive name to the shortcut.
You’re finished. Using this shortcut will now send the text contents copied to your Windows Clipboard to the selected file.
It is important to note that the ClipOut tool only supports outputting text. If you had binary data copied to your clipboard then the output would be empty.

Changing the Icon

By default, the icon for the shortcut will appear as a command prompt, but you can easily change this by editing the properties of the shortcut and clicking the Change Icon button. We used an icon located in “%SystemRoot%\System32\shell32.dll”, but any icon of your liking will do.
As an additional tweak, you can set the properties of the shortcut to run minimized. This will prevent the command window from “blinking” when the send to command is run (instead it will blink in your taskbar which is hardly noticeable).

Links

No comments:

Post a Comment