windows - 使用 Windows 批处理文件在文本文件中添加新行

标签 windows batch-file newline stdout

我有一个超过 200 行的文本文件,我只想在第 4 行之前添加一个新行。我使用的是 Windows XP。

输入前的示例文本文件:

header 1
header 2
header 3
details 1
details 2

输出后:

header 1
header 2
header 3
<----- This is new line ---->
details 1
details 2

最佳答案

我相信你正在使用

echo Text >> Example.txt 

功能?

如果是这样,答案就是简单地添加一个“.”。 (点)直接在回声之后,没有其他任何东西。

例子:

echo Blah
echo Blah 2
echo. #New line is added
echo Next Blah

关于windows - 使用 Windows 批处理文件在文本文件中添加新行,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/7396680/

相关文章:

linux - Qt Creator - 在 Windows 上构建持续时间更长

windows - 如何在批处理中检查文件是否为空

java - 动态设置java进程的最大堆大小

Java 通过带问号的换行符正则表达式拆分字符串

c++ - 使窗口完全透明的问题

c++ - 将 WPARAM 传递到 DragQueryFile 不兼容?

windows - 如何在git bash下更改目录

Windows CMD 批处理 : concatenating variable NAME in a loop

Git:使用 git hook 将回车符\r 转换为新行\n?

c# - XNA StreamReader/Writer如何在不同的行中读/写?