Re: Any way to write to a file in DOS batch file


[ Follow Ups ] [ Post Followup ] [ The EasyDOS Forum ] [ FAQ ]

Posted by JB on March 28, 2008 at 12:34:34:

In Reply to: Re: Any way to write to a file in DOS batch file posted by 20080328 on March 28, 2008 at 03:56:28:

: : ... how do I include line breaks?

: echo.>fubar.txt

: or

: echo.>>fubar.txt

:
: :... And do I have to "build" the new file line by
: : line using a new line in the batch file for each
: : line I want to put in the created file?
: Yes, pretty much. You could do something like so (from the command line):

: for %x in (apples oranges pears bananas) do echo %x>>fubar.txt

: The results in fubar.txt would be:

: apples
: oranges
: pears
: bananas

: To use this command from within a batch file, double-up the percent signs like so:

: for %%x in (apples oranges pears bananas) do echo %%x>>fubar.txt

: To learn more about the "for" command, type:

: for /?

: at the cmd (or command) prompt.

Great. Thanks again.


Follow Ups:



Post a Followup (use TAB key to move between boxes - NOT ENTER or RETURN)

Name:
E-Mail:

Subject:

Type your comments in the box below and SUBMIT:


[ Follow Ups ] [ Post Followup ] [ The EasyDOS Forum ] [ FAQ ]