Use output redirection >
and >>
echo one>%file%
echo two>>%file%
echo three>>%file%
Or in a more readable way: (In cmd.exe
, using “echo one >%file%
” would include the whitespace before >
.)
>%file% echo one
>>%file% echo two
>>%file% echo three
You could also use:
(
echo one
echo two
echo three
) >%file%