How can you echo a newline in batch files?

How can you you insert a newline from your batch file output?

I want to do something like:

> echo hellonworld

Which would output:

hello
world


echo hello & echo.world

This means you could define & echo. as a constant for a newline n .


使用:

echo hello
echo.
echo world

Here you go, create a .bat file with the following in it :

@echo off
REM Creating a Newline variable (the two blank lines are required!)
set NLM=^


set NL=^^^%NLM%%NLM%^%NLM%%NLM%
REM Example Usage:
echo There should be a newline%NL%inserted here.

echo.
pause

You should see output like the following:

There should be a newline
inserted here.

Press any key to continue . . .

You only need the code between the REM statements, obviously.

链接地址: http://www.djcxy.com/p/30286.html

上一篇: 在Windows上忽略Git仓库中的目录

下一篇: 你怎么能在批处理文件中回显一个换行符?