Windows: Create Batch file to copy text to clipboard

Here’s how you can create a batch file that will copy a one line text to the clipboard.

  • Open notepad or any text editor
  • Copy the following text into the empty file:
echo|set/p=<text_to_copy>|clip
  • Save the file with a .bat extension. Make sure there is no .txt at the end of it, just .bat.
  • Now, to copy the text, just double click the file from where it is saved. The <text_to_copy>, including the < and > signs, will be copied to the clipboard. You can then just paste the copied text where you want.
Advertisements