简体   繁体   中英

How to merge file in to one with “enter”(New line) in windows batch file?

Good morning guys,

I am going to merge 3 files into one. But I tested script as below:

Del Worker_all_for.dat
Type Worker1.dat > Worker_all_for.dat
echo >> Worker_all_for.dat
Type Worker2.dat >> Worker_all_for.dat
echo. >> Worker_all_for.dat
Type Worker3.dat >> Worker_all_for.dat

But I cannot add "break" between each file.

For example:

Worker1.dat
1
2
Worker2.dat
3
4
Worker4.dat
5
6

The Worker_all_for.dat will be the:

1
23
45
6

But my purpose is to get:

1
2
3
4
5
6

I did a search, but I just can find on Unix, not On windows. Thanks in advance!

Use the command echo. to print a new line.

Del Worker_all_for.dat
Type Worker1.dat > Worker_all_for.dat
echo. >> Worker_all_for.dat
Type Worker2.dat >> Worker_all_for.dat
echo. >> Worker_all_for.dat
Type Worker3.dat >> Worker_all_for.dat

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM