Take the 2-minute tour ×
Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

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

1 Answer 1

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

 
discard

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.