将字符串回显到多行.txt文件-Windows批处理文件 [英] Echo string to .txt file with multiple lines - with Windows Batch file

查看:76
本文介绍了将字符串回显到多行.txt文件-Windows批处理文件的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试创建Windows批处理文件,该文件以多行创建一个.txt.我尝试了几种在字符串中插入换行符的解决方案,但无济于事.还有其他类似的问题/答案,但是都没有解决将整个字符串放入文本文件的问题.

I am attempting to create a Windows Batch File that creates a .txt with mulitple lines. I've tried several solutions to insert a line break in the string but no avail. There are other similar questions/answers but none of them address putting the entire string into a text file.

我的批处理文件当前显示为:

My batch file currently reads:

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

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

my goal is to have the text file read:

Here is my first line
Here is my second line

显然,这目前不起作用,但是想知道是否有人知道如何以一种简单的方式实现这一目标?

Obviously, this does not work currently, but wondering if anyone knows how to make this happen in a simple fashion?

推荐答案

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

这篇关于将字符串回显到多行.txt文件-Windows批处理文件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆