Dump contents of a cmd prompt into a file, from a batch file

You just need to add this to the end of whatever runs the batch file: > "c:\yourFile.txt"

(or >> "c:\yourFile.txt" if you want the results appended to the file without overwriting)

eg: c:\yourBatchFile.bat >> c:\yourLogFile.txt


FYI... just using the greater-than like in the other answers won't capture error output, only stdout... So any errors would still go to the command line display and not to your log file and you still would not be informed of any failures.

For both stdout and stderr you need this syntax:

[batchFilePath] > [logFilePath] 2>&1


Try redirecting the output by putting ">" and a filename after the scheduled command, as in:

C:\MyBatchFile.bat > output.txt

Putting two ">", as in ">>", will append instead of overwriting.