echo.
Enough said.
If you need it in a single line, use the &
. For example,
echo Line 1 & echo. & echo line 3
would output as:
Line 1
line 3
Now, say you want something a bit fancier, ...
set n=^&echo.
echo hello %n% world
Outputs
hello
world
Then just throw in a %n%
whenever you want a new line in an echo statement. This is more close to your \n
used in various languages.
Breakdown
set n=
sets the variable n
equal to:
^
Nulls out the next symbol to follow:
&
Means to do another command on the same line. We don't care about errorlevel(its an echo statement for crying out loud), so no &&
is needed.
echo.
Continues the echo statement.
All of this works because you can actually create variables that are code, and use them inside of other commands. It is sort of like a ghetto function, since batch is not exactly the most advanced of shell scripting languages. This only works because batch's poor usage of variables, not designating between ints, chars, floats, strings, etc naturally.
If you are crafty, you could get this to work with other things. For example, using it to echo a tab
set t=^&echo. ::there are spaces up to the double colon