用多行回声string到.txt文件 – 用Windowsbatch file

我正在尝试创build一个Windowsbatch file来创build多行的.txt文件。 我已经尝试了几个解决scheme,在string中插入换行符,但没有用。 还有其他类似的问题/答案,但没有一个地址把整个string放到一个文本文件中。

我的batch file目前读取:

echo Here is my first line Here is my second line > myNewTextFile.txt pause 

我的目标是读取文本文件:

 Here is my first line Here is my second line 

很明显,目前这种方法并不奏效,但是想知道是否有人知道如何以简单的方式来实现这一点?

 ( echo Here is my first line echo Here is my second line echo Here is my third line )>"myNewTextFile.txt" pause 

在第一个之后重复echo>>行。 >>意味着它应该追加到一个文件而不是创建一个新的文件(或覆盖一个现有的文件):

 echo Here is my first line > myNewTextFile.txt echo Here is my second line >> myNewTextFile.txt echo Here is my third line >> myNewTextFile.txt pause 

以下工作我。

 {Here is my first line Here is my second line Here is my third line} > "myNewTextFile.txt" 

没有Echo需要和使用正常的括号()即使有一个转义字符,没有工作。