set dest=\\machinename\destinationshare xcopy \\machinename\sourceshare\*.* %dest% /s /d /y if errorlevel 1 goto failure echo.>> %dest%\copylog.txt echo Date and time of successful backup >>%dest%\copylog.txt echo.|date|find "current">>%dest%\copylog.txt echo.|time|find "current">>%dest%\copylog.txt GOTO END :failure echo.>> %dest%\copylog.txt echo Date and time of failed backup >>%dest%\copylog.txt echo.|date|find "current">>%dest%\copylog.txt echo.|time|find "current">>%dest%\copylog.txt :END