How to make the echo command without new line in Windows

By default, the echo command adds a new line character to its output. For example, if you print some environment variable, the output will be appended with an extra line. The extra line can create a problem if you wish to copy the output to the clipboard to be used in another command. Today we will see how to get rid of the new line character in the echo command output at the command prompt.

echo userprofile
There are several scenarios when you wouldn't want the additional line. For example, if you are using a combination of "clip" and "echo" commands as described in the article How to copy the command prompt output directly to the Windows clipboard, the new line character will be a hindrance.

To remove it from the output, use the following syntax:

echo | set /p=some text or variable

For example:
echo no new line
In case you need to use such syntax with the clip command, you need to use it as follows:

echo | set /p=some text or variable|clip

No new line character will be present in the clipboard:
notepad no new line
That's it.

1 thought on “How to make the echo command without new line in Windows

  1. Rockie

    Thank You much! Was very helpful!

    Best ragards,


Leave a Reply

Your email address will not be published. Required fields are marked *