windows 如何使用批处理文件附加文本文件

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/19750653/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-09-09 11:02:36  来源:igfitidea点击:

How to append text files using batch files

windowsbatch-file

提问by Uffe Kousgaard

How can I append file1 to file2, from a batch file? Text files and only using what is "standard" on windows.

如何从批处理文件将 file1 附加到 file2?文本文件,并且仅使用 Windows 上的“标准”文件。

回答by Ray Toal

It is as simple as

就这么简单

type file1 >> file2

回答by Bob Maiers

You mightget better results with the following:

可能会通过以下方式获得更好的结果:

copy /b file1.txt+file2.txt result.txt

I use this command to combine dozens of XML files together. The "/b" puts the copy process in binary mode. This eliminated the control character that was appending to the end of my destination file.

我使用此命令将数十个 XML 文件组合在一起。"/b" 将复制过程置于二进制模式。这消除了附加到我的目标文件末尾的控制字符。

回答by djna

COPY file1.txt+file2.txt result.txt