Sei sulla pagina 1di 4

How to Merge Text (.

Txt) Files in Command


Prompt
If you have a bunch of text files in a folder on your computer which you'd like to merge together,
you can simply do just that with one easy command in Command Prompt. This will help with
various things including word lists, dictionaries and help clean up your folder a little more.

Steps

1.
1
Navigate and open the directory (folder) where all the text (txt) files are located
which you'd like to merge together are located in Command Prompt.

2.
2
Left click a blank space in the folder to ensure you haven't selected anything and
hold CTRL + Shift and Right click in a blank space.

3.
3
You will see the option Open command window here, select it so the Command
Prompt has automatically been pointed to that directory while opening to continue
executing the merge command.
o

If you didn't see that option, go to your Start Menu and search for "cmd" and open
"cmd.exe" - If you're using XP, click Run and type in "cmd". Once you've
successfully opened it, type cd C:\ and navigate to the directory with the text
files in it. For example, I have a folder called ' files ' on my Desktop, I'd type cd
C:\Users\User\Desktop\files and you should replace 'User' with the account
name you're logged in to.

4.
Now Command Prompt is open and pointed to the directory with the text files in it,
we can execute the following command. for %f in (*.txt) do type "%f" >>
output.txt This command will select all the text (.txt) files in the directory and output
them all merged together into the new text file called output.txt which you can rename to
whatever you like.
o

Echo each new line after reading each file, as every new file written to the merged
file will start at the end of the last current line.

Potrebbero piacerti anche