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've been using

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

to concentate many many files in Command Prompt. Using this one because it adds the file name before each individual file. Problem is it ends up duplicating. I think that's because it's putting it in the same folder. How can I amend this script to dump it into a different folder?

share|improve this question
Um, >> ..\otherdir\newfile.prt? – Scott Mar 12 '13 at 20:05

Reference the different directory instead... Example:

for %%i in (*.prt) do (
   echo %%i>> "<OTHER_DIRECTORY>\newfile.prt"
   type %%i>> "<OTHER_DIRECTORY>\newfile.prt"

Or if not in a batch file:

for %i in (*.prt) do echo %i>> "<OTHER_DIRECTORY>\newfile.prt" && type %i>> "<OTHER_DIRECTORY>\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.