Super User is a question and answer site for computer enthusiasts and power users. Join them; it only takes a minute:

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 one .txt file with some text that I want to append to all .txt files in a folder.

Can anyone explain to me how to do it?

share|improve this question
Do you want to replace the existing content of the other files, or do you want to append the text to the existing file contents? (Or anything else?) – Arjan Mar 16 '13 at 11:37
I want to append the text to the existing file contents... – Noober Mar 16 '13 at 11:48
up vote 2 down vote accepted

I suggest to rename the file which should be appended to append_me (or anything without .txt extension), then you can use a FOR loop over *.txt files in a batch file append.bat:

@echo off
for %%a in (*.txt) do type append_me >> %%a
  • @ suppresses the printing of the follwing command line prior to execution
  • echo off does the same for all following commands
  • %%a defines a variable, which takes (one after another) the *.txt file names (*)
  • type displays the file content (Linux analogon is cat)
  • >> appends that content to the current file (%%a)

(*) If you use that command directly on the command line, use only %a; see for /? for the complete syntax of for loops.

share|improve this answer
Thanks for fast answer... It's working... – Noober Mar 16 '13 at 13:47

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .