Page 1 of 1

how to put multiple lines of text into a single document

Posted: 02 Jul 2011 17:22
by BatMaster
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

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

Posted: 02 Jul 2011 17:47
by dbenham
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

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

Posted: 02 Jul 2011 19:21
by nitt
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

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

Posted: 03 Jul 2011 09:47
by BatMaster
Thanks A lot Guys thats really helpful
BatMaster