Question

  • Creator
    Topic
  • #2158055

    Output the output of a batch file in a log file

    Locked

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

    Rgds,
    Rains

All Answers

  • Author
    Replies
    • #2948300

      Clarifications

      by happycoolrains ·

      In reply to Output the output of a batch file in a log file

      Clarifications

    • #2948292

      Redirect the output

      by bizzo ·

      In reply to Output the output of a batch file in a log file

      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.

Viewing 1 reply thread