2010-02-22 01:59:20 +0000 2010-02-22 01:59:20 +0000
100
100
Advertisement

一个命令行或批处理的cmd来串联多个文件

Advertisement

我在一个目录下有50个文本文件。

有没有一个Windows命令行方法来串联这些文件到一个文件中?

我使用的是Windows Vista

Advertisement
Advertisement

答案 (4)

38
38
38
2013-04-11 08:55:42 +0000

若要在每一个合并后的文件末尾添加新的Line,请用type代替copy,如下所示:

type *.txt > newfile.txt
32
32
32
2010-02-22 02:08:22 +0000

假设你说的是附加文本文件,那么copy命令可以用来附加文本文件:

copy file1+file2+file3 targetfile

如果你有很多文件,你可以通过一次附加一个文件来循环。

8
Advertisement
8
8
2014-08-10 08:06:10 +0000
Advertisement

在命令提示符中运行以下命令:

for %f in (*.txt) do type "%f" >> output.txt
3
3
3
2014-05-12 11:52:25 +0000

下面的.bat文件将把所有的*.for文件,除了名为XIT.for的文件外,都附加到一个名为MASTER.for

type NUL > MASTER.for
FOR %%G IN (*.for) DO IF NOT "%%G" == "XIT.for" copy /A MASTER.for+"%%G" && echo. >> MASTER.for

的空白文件中。)

Advertisement

相关问题

3
19
10
28
4
Advertisement