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'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
3  
Um, >> ..\otherdir\newfile.prt? –  Scott Mar 12 '13 at 20:05

1 Answer 1

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

 
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.