The closest I can come up with is:
echo 123 > out.txt
However this gives a trailing space and also a trailing newline.
migrated from serverfault.com Oct 13 '12 at 21:24
This question came from our site for professional system and network administrators.
coreutils contains "echo". You can use the "-n" flag to supress the trailing newline
There is no trailing space, but there is a newline.
If you want to do this in cmd, the answer you provided in your question is the "correct" way, but there are obvious formatting issues
Use copy con
Press Control-Z to end input
'con' is a keyword signifying console.
copy src dest
copy con mynewfile
src - con - console
dest - mynewfile - destination