How to Merge Multiple Text Files using different methods in Windows
Last updated
Last updated
If you want to merge multiple text *(.txt) files into a single new file in Windows 10 or 11, you can easily do so in Command Prompt using the "copy" command. You can also merge text files using PowerShell commands, or by copying and pasting in Notepad. Before you get started, place all the files that need to be joined into a single folder.
Open the folder containing the files you want to combine.
Hold down Shift and right-click in the folder.
Click Open command window here or Open Terminal here.
If using Terminal, click the down-arrow and select Command Prompt.
Type copy *.txt newfile.txt and press Enter to merge.
Right-click the Start button and select File Explorer. The 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, 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.
Open the folder in which the 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.
Press ⇧ Shift as you right-click a blank area of the right panel. A context menu will expand.
Click Open command window here. This opens a command prompt window that's already set to the current directory.
If the option isn't available in Windows 10, right-click the taskbar at the bottom of the screen and select Taskbar settings. Toggle off the option that says "Replace Command Prompt with Windows PowerShell in the menu when I right-click the start button or press Windows key + x", then try again.
Type copy *.txt newfile.txt at the prompt and press ↵ Enter. This command combines all files ending in .txt into a single file called newfile.txt. You can replace newfile.txt with the name of the file you want to create (e.g., mergedfiles.txt).
Once you've verified that your output file looks how you'd like, you can delete the files you no longer need.
Right-click the Start button and select File Explorer. If you prefer using PowerShell to Command Prompt, merging text files into one is similar, but the commands are slightly different.
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, copy them to a single folder first.
Open 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.
Press ⇧ Shift as you right-click a blank area of the right panel. A context menu will expand.
Click Open PowerShell window here…. This opens a new PowerShell window to the directory that contains your text files.
Run the command Get-Content file1.txt, file2.txt | Set-Content newfile.txt. Replace file1.txt, etc., with the file names you want to merge. You can also replace newfile.txt with the name you want to give to the final merged file.
If you want to merge all text files in the current directory into a single text file, use the command Get-Content *.txt .
Open the text files in Notepad. If you just want to combine 2 or 3 text files into a single text file, you can do it easily with Notepad.
Open Notepad by typing notepad into the Windows search bar and clicking Notepad.
Click File > Open, select the first text file, then click Open.
Repeat for other text files you want to combine.
Create a new blank text file in Notepad. If you're using Windows 11, go to File > New tab to create the file in a new tab. On Windows 10, just open another new instance of Notepad.
Copy the text from the first file you want to combine. An easy way to do this is to click anywhere in the text, press Ctrl + A on the keyboard to select all, then press Ctrl + C to copy.
Paste the copied text into the blank text file. In your new blank Notepad file, click anywhere in the file, then press Ctrl + V to paste the copied text.
Repeat for the other files you want to combine. Go to your next text file, press Ctrl + A to select all, then press Ctrl + C to copy. In your new blank file, click where you want to paste the copied text, then press Ctrl + V to paste.
Save your file. In the new file that contains your merged text, go to File > Save as, give the file a name, and click Save.
If you're using Windows 11 and don't see the option to open the command window, select Open in Terminal instead. Then, once the is open, click the down-arrow at the top of the window and select Command Prompt.
If you just want to combine two or more text files into a single file but not all text files in the directory, use the command copy file1.txt+file2.txt+file3.txt newfile.txt. Replace file1, etc., with the names of the files you want to combine.