DOS Command to Merge Files


You may have the need to merge together a few files into one file. Merging text files into one file is easy with a DOS command (or an equivalent command on a Mac). You could use the cut and paste method but that is slow and could easily lead to errors.

To do this, first copy all of the files you need to merge into the same directory. Then open a command prompt in the same directory as the location of your files. To do this you can use Windows Explorer to navigate to the folder where your files are and then press Ctrl+Shift and right click the mouse, then select Open command window here. We use a basic copy command to do the merge.

copy /b *.txt newfile.txt

This will merge all files in the current directory with a .txt extension into one file called newfile.txt.

Here is another command that I found at WikiHow.com that uses the for command.

for %f in (*.txt) do type "%f" >> output.txt

Leave a comment

Your email address will not be published. Required fields are marked *