Using echo without trailing space in DOS

Rayne picture Rayne · Sep 20, 2012 · Viewed 15k times · Source

I noticed that when I use echo to print something to a file in DOS, a space is appended to the string. I need to print the string without the trailing space. Is there a way to do that, or as a workaround, remove trailing spaces from the file?

Answer

Dennis picture Dennis · Sep 20, 2012

If I understood the problem correctly, you wrote the trailing space.

Instead of

echo string > file

use

echo string>file