Search code examples
echodosspace

Using echo without trailing space in DOS


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?


Solution

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

    Instead of

    echo string > file
    

    use

    echo string>file