How to echo "2" (no quotes) to a file, from a batch script? How to echo "2" (no quotes) to a file, from a batch script? windows windows

How to echo "2" (no quotes) to a file, from a batch script?


Little-known feature: The redirection operator can go anywhere on the line.

>>file.txt echo 2


Use (ECHO 2)>>file.txt. This will output 2 without any spaces.