Printing empty lines
echo
prints an empty line if the command is followed by a colon:
@echo:
@echo An empty line will be printed.
@echo:
@echo a colon following echo did the trick.
With echo(
, it's also possible to print indented text:
@echo( 1
@echo( 1 1
@echo( 1 2 1
@echo( 1 3 3 1
@echo( 1 4 6 4 1
Suppress traling new line
The
bash built-in echo
command has the
-n
options which suppresses
new lines. Unfortunately (but not so surprisingly),
cmd.exe's version of
echo
does not have such an option. However, the new line of
echo
can be piped into
set /p
to write text without trailing new lines:
@echo off
echo | set /p="Writing "
echo | set /p="a "
echo | set /p="text "
echo | set /p="line "
echo | set /p="word "
echo | set /p="for "
echo word.