Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to append content of one textfile to another textfile using batchscript?

How to create a simple batchscript in windows that will take the contents of one txt file and will append it to the end of another textfile

like image 634
Mat Avatar asked May 15 '12 12:05

Mat


People also ask

How do I append to a batch file?

Content writing to files is also done with the help of the double redirection filter >>. This filter can be used to append any output to a file. Following is a simple example of how to create a file using the redirection command to append data to files.

How do you append with a cat?

You can use cat with redirection to append a file to another file. You do this by using the append redirection symbol, ``>>''. To append one file to the end of another, type cat, the file you want to append, then >>, then the file you want to append to, and press <Enter>.


2 Answers

The type command can be used to concatenate files. Try

type file1.txt >> file2.txt
like image 52
Brett Walker Avatar answered Sep 23 '22 06:09

Brett Walker


Brett's answer works well. Another alternative is

copy file1.txt + file2.txt /b

You can append any number of files with this syntax by adding additional files.

The /b option prevents the <ctrl-Z> end-of-file marker from being appended to the end of the file after the copy.

like image 20
dbenham Avatar answered Sep 23 '22 06:09

dbenham