This article was co-authored by wikiHow staff writer, Nicole Levine, MFA. Nicole Levine is a Technology Writer and Editor for wikiHow. She has more than 20 years of experience creating technical documentation and leading support teams at major web hosting and software companies. Nicole also holds an MFA in Creative Writing from Portland State University and teaches composition, fiction-writing, and zine-making at various institutions.
The wikiHow Tech Team also followed the article's instructions and verified that they work.
This article has been viewed 692,137 times.
Learn more...
This wikiHow teaches you how to combine multiple text files into a single new file using the Windows command prompt. The simplest way to do this is to place all of the files that need to be joined into a single folder and then run the joining command from that folder.
Steps
-
1Right-click the Start button and select File Explorer. The Start menu is usually at the bottom-left corner of the screen.You'll want the files to be in the same folder to make things easier from the command prompt. If the files are scattered in multiple locations, make sure you copy them to a single folder first.
Make sure all of your text files end with a blank line (or the dividing text of your choice) to make it clear where each section begins.
-
2Open the folder in which the text files are saved. Start by opening the This PC or Computer directory in the right panel, and then browse to the folder where you've saved your files. Once you open the folder, you should see your text files in the right panel.Advertisement
-
3Press ⇧ Shift as you right-click a blank area of the right panel. A context menu will expand.
-
4Click Open command window here. This opens a command prompt window that's already set to the current directory.
- If you enabled Windows PowerShell, you'll have to click Open PowerShell window here instead.
-
5Type copy *.txt newfile.txt at the prompt. Replace newfile.txt with the name of the file you want to create (e.g., mergedfiles.txt).
-
6Press ↵ Enter to join the files. This creates a new file with containing the contents of all text files in the current folder.[1]
- Once you've verified that your output file looks how you'd like, you can delete the files you no longer need.
Community Q&A
-
QuestionWhy am I getting extra copies of every file?Matt McCombsCommunity AnswerYou may have your output set to the same file type as your inputs.This would cause the program to read the output file after its initial creation and add in copies of the previously merged documents.
-
QuestionI have merged text files into one, but the prompt included the files in random order. Can it also merge files in an ordered fashion?Community AnswerIf you have three files, A.TXT, B.TXT and C.TXT and you want to combine them in the order CAB in the file CAB.TXT, you can use the copy command as follows: copy C.TXT+A.TXT+B.TXT CAB.TXT.
-
QuestionHow do I separate the content of text files from one another?Community AnswerYou can take the text from the other ones, cut them and paste them into another text editing program, or you could just leave it alone and let them stay.
About This Article
1. Open File Explorer.
2. Open the folder that contains the text files.
3. Press Shift and right-click in the folder.
4. Click Open command window here.
5. Type copy *.txt newfile.txt.
6. Press Enter.