How can I echo a newline in a batch file? How can I echo a newline in a batch file? windows windows

How can I echo a newline in a batch file?


echo hello & echo.world

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


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

@echo offREM 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 newlineinserted here.Press any key to continue . . .

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