Computer Hope

Microsoft => Microsoft DOS => Topic started by: vgsangiuliano on January 28, 2009, 03:22:31 AM

Title: Write to file with echo and use \n
Post by: vgsangiuliano on January 28, 2009, 03:22:31 AM
Hi i'm wondering if there is way to append text to some file going to the next line.
For exampe if my text file is text.txt and contains the line this is an example using echo this is another example>>text.txt the results is in the file text.txt is:

this is a examplethis is another example  while i would like to have

this is an example
this is another example

Thank you
Title: Re: Write to file with echo and use \n
Post by: fireballs on January 28, 2009, 03:35:12 AM
Code: [Select]
echo.>>test.txt That will append a blank line onto test.txt

FB
Title: Re: Write to file with echo and use \n
Post by: Biker Steve on February 13, 2009, 06:19:48 AM

Using only one ">" within the @echo command will either create a new "test.txt file" if one does not already exist or over write the contents of the "test.txt" file should one already exist.

@echo This will create a file with new contents > test.txt

Using two ">>" within thin the @echo command will append this line to the existing "test.txt" file.

@echo This will append this line to the end of the file >> test.txt