Doubt when joining txt files

Asked

Viewed 1,438 times

2

Searching the internet to join txt files, I found the command line code CMD below:

for %f in (*.txt) do "%f" >> união.txt

The logic is to make a loop, grab all the txt files and create a new file 'union.txt' with all of them together.

The same does not work, it opens all the files and creates the new, but the new is blank.

Any hint?

2 answers

3


I can solve this way:

for %f in (*.txt) do type "%f" >> união.txt

The code says the following:

for %f in (*txt) //loops all files. txt

do type //the type command was missing he is the write command

"%f" >> união.txt //writes the contents of the files inside the.txt union file

  • 2

    Could you elaborate on your answer? It would be interesting if I could give you more details than you’ve changed, and how that differs from the question code.

  • @Stormwind gave an explanation in command. Hug

2

Use a copy /Bignaria:

copy /B *.txt unir.txt

Browser other questions tagged

You are not signed in. Login or sign up in order to post.