Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I have thousands of .prt files that I'm combining in CMD using:

copy /b *.prt newfile.prt

I'm importing those into Excel, and it works just fine, other than I would love to include the individual files names as well.

Is there a command I can use for this in CMD? Or something to add to the one I'm using? Any help would be greatly appreciated.

share|improve this question

The command for offers a more flexible way of working with a set of files. The following command will be functionally similar to copy /b *.prt newfile.prt:

for %i in (.\*.prt) do type %i >> newfile.prt

Depending on exactly how you want to include filenames in the new concatenated file, your implementation may be different. Below is merely an example, where the name of every individual file preceeds its contents in the new one:

for %i in (.\*.prt) do echo %i >> newfile.prt && type %i >> newfile.prt
share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.