2

When executing

echo 0 > test.txt

in cmd.exe, the output in test.txt is

0_

where _ means space. Why is there a space appended? Any way to prevent the appending of the space? Thanks!

stefan.at.kotlin
  • 15,347
  • 38
  • 147
  • 270

1 Answers1

8

The space that gets appended is the space between the "0" and the ">" in your command line. There is a non-obvious way to get rid of it: prepend the redirection to the command instead:

>test.txt echo 0
Jon
  • 428,835
  • 81
  • 738
  • 806