You can redirect the output of a cmd prompt to a file using >
or >>
to append to a file.
i.e.
echo Hello World >C:\output.txt
echo Hello again! >>C:\output.txt
or
mybatchfile.bat >C:\output.txt
Note that using >
will automatically overwrite the file if it already exists.
You also have the option of redirecting stdin, stdout and stderr.
See here for a complete list of options.