Hello. How to make a transition to the next line by code

echo(первая строка{следующая строка>text.txt 

we know that there is a double >>, or editors embedded in cmd. But the way through echo interests one record. and naturally logically, I thought about the escape sequence:

 echo(первая строка{\nвторая строка{ 

but since I understand that there should be an escaping symbol, for example:

 echo(первая строка{^\nвторая строка{ 

Nevertheless, it did not help, tell me, maybe I want to combine the incompatible?

  • one
    Are you running a script on Windows or Linux? - excellproj
  • sorry forgot windows 10 - Pashka Fincler
  • @excellproj, in theory, cmd is windows, and bash is linux. - Qwertiy
  • one
    @Qwertiy I know, but as we see in the question cmd + bash = win10 - excellproj

1 answer 1

  1. Here is an example for a bat file taken from the English forum .

     set NLM=^ set NL=^^^%NLM%%NLM%^%NLM%%NLM% @echo First Line%NL%Second Line>text.txt 

    After the character "insert character" in the line set NLM=^ nothing should be. After the specified variable declaration line are two blank lines.

  2. And, in principle, it would be easier to do in one line, changing the execution of a queue of several commands.

     @echo First line>text.txt&@echo Second line>>text.txt