Output the output of a batch file in a log file

By happycoolrains ·
I am copying(XCOPY) and renaming(RENAME) certain files from one directory to the other. Basically doing a backup process using batch file.

I want to output the outputs of XCOPY and RENAME directly into a log file. How can I do this.?


This conversation is currently closed to new comments.

Thread display: Collapse - | Expand +

All Answers

Collapse -

Redirect the output

by Bizzo In reply to Output the output of a ba ...

You can redirect the ouptut using ">" and ">>"

xcopy folder1\file.txt . > output.log
rename file.txt filenew.txt >> output.log

Using ">" will create a file (in this case) called output.log. If the file already exists, it will be deleted.

Using ">>" will append to the file if it already exists, else it will create a new one.

Related Discussions

Related Forums