Windows 对文本文件使用“复制”时的换行
我有一个文本文件Windows 对文本文件使用“复制”时的换行,windows,batch-file,Windows,Batch File,我有一个文本文件a.txt hello there how are you? hello therehow are you? 和一个文本文件b.txt hello there how are you? hello therehow are you? 通过使用copy a.txt+b.txt c.txt我得到了一个c.txt hello there how are you? hello therehow are you? 我需要如何更改命令才能在那里和如何之间获得新行/换行?不是
a.txt
hello
there
how
are
you?
hello
therehow
are
you?
和一个文本文件b.txt
hello
there
how
are
you?
hello
therehow
are
you?
通过使用copy a.txt+b.txt c.txt
我得到了一个c.txt
hello
there
how
are
you?
hello
therehow
are
you?
我需要如何更改命令才能在
那里
和如何
之间获得新行/换行?不是很优雅,但它可以工作:
for %%a in (a.txt,b.txt) do type %%a >>c.txt && echo. >>c.txt
不过,列表中最后一个文件的末尾将有一个空行
如果要使用通配符:
for /f "tokens=*" %%a in ('dir /b *.txt') do type "%%a" >>c.txt && echo. >>c.txt
使用
COPY
命令无法执行任何操作。您需要在a.txt的末尾获得一个CRLF<代码>回音。>>a、 txt&复制a.txt/a+b.txt/a c.txt@Squashman你可能是说“什么都不能做”不。那是双重否定。让我换一种说法。使用COPY命令无法更改任何内容。如何将其与COPY*.txt c.txt
一起使用?@P.Dee,使用诸如COPY*.txt c.txt
之类的通配符不是一个好主意,因为*.txt
也与目标c.txt
匹配,这可能会导致意外结果。。。