how to put multiple lines of text into a single document

Discussion forum for all Windows batch related topics.

Moderator: DosItHelp

Post Reply
Message
Author
BatMaster
Posts: 28
Joined: 22 Dec 2010 12:53

how to put multiple lines of text into a single document

#1 Post by BatMaster » 02 Jul 2011 17:22

Hello the reaason why i started this topic is because i want to put multiple lines of text into a single document usin a batch file
i know how to put single lines of text into a document

Code: Select all

echo helloworld>hw.txt

it would be really helpfull ifyou could
but if you cant just tell me
thanks in advance BatMaster

dbenham
Expert
Posts: 2461
Joined: 12 Feb 2011 21:02
Location: United States (east coast)

Re: how to put multiple lines of text into a single document

#2 Post by dbenham » 02 Jul 2011 17:47

Use the append redirection (>>). If the file does not exist, it will create it. If it does exist it will append to the end.
example:

Code: Select all

echo line1>>test.txt
echo line2>>test.txt
echo line3>>test.txt


Dave Benham

nitt
Posts: 218
Joined: 22 Apr 2011 02:43

Re: how to put multiple lines of text into a single document

#3 Post by nitt » 02 Jul 2011 19:21

dbenham wrote:Use the append redirection (>>). If the file does not exist, it will create it. If it does exist it will append to the end.
example:

Code: Select all

echo line1>>test.txt
echo line2>>test.txt
echo line3>>test.txt


Dave Benham


Or you can use:

Code: Select all

(
echo line1
echo line2
echo line3
)>test.txt

BatMaster
Posts: 28
Joined: 22 Dec 2010 12:53

Re: how to put multiple lines of text into a single document

#4 Post by BatMaster » 03 Jul 2011 09:47

Thanks A lot Guys thats really helpful
BatMaster

Post Reply