Question Locked

Output the output of a batch file in a log file

0 helpful
2 replies
Closed to new repliesThis discussion is closed. It stays readable, but it takes no new replies.

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.?

Rgds,
Rains

2 replies

by bizzo

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

e.g.
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.

This discussion is closed to new replies.