(SOLVED) Merging files .bat

Discussion forum for all Windows batch related topics.

Moderator: DosItHelp

Post Reply
Message
Author
jmituzas
Posts: 13
Joined: 30 Aug 2010 08:43

(SOLVED) Merging files .bat

#1 Post by jmituzas » 30 Aug 2010 13:37

I have a file called header.txt I want this file to be prepended (first line) to all *.txt files in the same directory.

How could I achieve this?

Thanks in advance,
Joe
Last edited by jmituzas on 31 Aug 2010 07:49, edited 1 time in total.

orange_batch
Expert
Posts: 442
Joined: 01 Aug 2010 17:13
Location: Canadian Pacific
Contact:

Re: Merging files .bat

#2 Post by orange_batch » 30 Aug 2010 22:07

I solved your second question in the previous thread, so I'm not going to write you a solution for this, unless it really is a new question. It's not hard but still a little more complicated, especially if header.txt contains multiple lines.

ghostmachine4
Posts: 319
Joined: 12 May 2006 01:13

Re: Merging files .bat

#3 Post by ghostmachine4 » 31 Aug 2010 04:30

jmituzas wrote:I have a file called header.txt I want this file to be prepended (first line) to all *.txt files in the same directory.

How could I achieve this?

Thanks in advance,
Joe

you can just use the >> redirection operator, the type command.

Code: Select all

type file >> header.txt

Post Reply