1

I'm looking for a way to log the results of multiple Robocopy runs from one bat script to one logfile so it's possible to lookup any errors in just one logfile. Is this possible? This is my script:

@echo off
set /p source="Enter Source laptop name: "

@echo off
set /p username="username: "


Robocopy "\\%source%\C$\Data" "C:\Data" /e /r:1 /w:0 

Robocopy "\\%source%\C$\tmpplm" "C:\tmpplm" /e /r:1 /w:0 

Robocopy "\\%source%\C$\Users\%username%\Contacts" "C:\Users\%username%\Contacts" /e /r:1 /w:0

Robocopy "\\%source%\C$\Users\%username%\My Videos" "C:\Users\%username%\My Videos" /e /r:1 /w:0

Robocopy "\\%source%\C$\Users\%username%\AppData\Local\Lotus" "C:\Users\%username%\AppData\Local\Lotus" /e /r:1 /w:0

Robocopy "\\%source%\C$\Users\%username%\AppData\Roaming\Microsoft\Windows\Recent\AutomaticDestinations" "C:\Users\%username%\AppData\Roaming\Microsoft\Windows\Recent\AutomaticDestinations" /S /r:1 /w:0

del "C:\Users\%username%\AppData\Local\Lotus\Notes\Data\notes.ini"

@echo off

POWERSHELL.EXE -Command "Add-Type -AssemblyName System.Windows.Forms; [void] [System.Windows.Forms.MessageBox]::Show( 'Replacement script ran. Check dialog box for any errors.', 'Replacement Script', 'OK', 'Information' )"
1
  • Robocopy has an append function, and it is listed in the robocopy help. Commented Jan 29, 2023 at 4:46

1 Answer 1

0

How do I log the results of multiple Robocopy runs to one logfile?

Use one of the following logging options:

  • /LOG+:file : Output status to LOG file (append to existing log).
  • /UNILOG+:file : Output status to Unicode Log file (append)

Source: Robocopy "Robust File Copy" - Windows CMD - SS64.com

You will need to add the chosen option to each one of your robocopy commands.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .