glbin

RobocopyDailyBackup

Aug 10th, 2025
10
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.35 KB | None | 0 0
  1. @echo off
  2. :: Get the day of the week (e.g. Monday, Tuesday, etc.)
  3. for /f %%i in ('powershell -NoProfile -Command "(Get-Date).DayOfWeek"') do set DayOfWeek=%%i
  4.  
  5. :: Define the paths
  6. set "Source=C:\FolderToBackup"
  7. set "BackupDestination=C:\Backup\%DayOfWeek%"
  8.  
  9. :: Perform the backup with Robocopy
  10. robocopy "%Source%" "%BackupDestination%" /MIR
  11. Pause
Advertisement
Add Comment
Please, Sign In to add comment