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.
echo ^2>>file.txt
appears to work for me.