Send text to Windows clipboard from a batch file

This is how to send text to Windows clipboard from within a batch file.

This is particularly useful if you often end up typing or copying the same blocks of text regularly. Once you’ve created the bat files, save them on the desktop and then every time you click on one Windows clipboard will have your text ready to paste!

echo off | clip in the following examples just clears the clipboard of any existing text first, it isn’t really necessary but I’ve kept it in as if you have any issues writing your batch / echo lines, you will at least know that the clipboard will be empty.

echo off | clip
echo This text will now be ready to paste when you run this bat| clip

If you have several lines of text, then you’ll need to wrap then in brackets ()

echo off | clip
echo This is line one
echo This is line two
echo this is line three
)| clip

If you need blank lines and want to get rid of Windows newline after each line of text then do the following.

echo off | clip
echo.|set /P=This is the first text line.
echo.|set /P This is the second text line.
echo.|set /P This is the third text line
)| clip
Print Friendly, PDF & Email

More Like This


Win 7 / 10 Tips & Tricks Windows XP Tips & Tricks


  • Gordon June 8, 2017 at 3:59 pm

    What if i want to copy to clipboard each argument passed to the script. Each one in a different line. Can you do this?

  • scunster June 8, 2017 at 4:39 pm

    Gordon, can you elaborate a little or provide an example of what you are wanting to achieve?

  • Matt July 27, 2017 at 7:56 pm

    This was much simpler than I had thought and what the other websites had shown. Much thanks!

  • Post a comment