Windows RoboBackup ScriptEverybody needs a backup, but not everybody wants all their data stored in the cloud. Until now, File History was good enough.

Starting with Win 11, it’s effectively crippled to push everyone to use OneDrive. Ug.

So, what to do?

I’ll tell you what: Back up Windows like a Pro! The robocopy command and a handy script I wrote is all you need.

And it only takes 5 minutes to set up!

Off we go:



video image


Links mentioned in the vid (some affiliate):

More Details

The following is the content of the batch script:

@echo off
REM ----------------------------
REM Scottie's RoboBackup Script
REM ----------------------------
REM The robocopy switches we use are as follows:
REM 	\MIR 		- Mirror directories (copy subdirs AND delete files that no longer exist). Use \E instead to never delete files.
REM 	\IM 		- backup modified files
REM 	\W:0 		- wait time before retrying failed file copy (zero!)
REM 	\R:1 		- number of retries of failed file copy before skipping
REM 	\XJ 		- exclude symbolic links and junction points
REM 	\XA:S 	- exclude system files
REM 	\NFL 		- No File Names: don't log every file backed up (makes logs huge)
REM 	\NDL 		- No Directory List: same as above, but for directories
REM 	1. To enable a line, remove 'REM'.
REM 	2. Replace YOUR_USERNAME with your Users folder name!
REM 	3. Change T: to the drive letter of your backup drive!
REM -------------
REM -------------
robocopy "C:\Users\YOUR_USERNAME" "T:\Backup\C\Users\YOUR_USERNAME" /MIR /IM /W:0 /R:1 /XJ /XA:S /NFL /NDL > C:\robo_backup.log
REM robocopy "E:\Users\YOUR_USERNAME" "T:\Backup\E\Users\YOUR_USERNAME" /MIR /IM /W:0 /R:1 /XJ /XA:S /NFL /NDL >> C:\robo_backup.log
REM --------------
REM --------------
REM robocopy "C:\Attic" "C:\Backup\C\Attic" /MIR /IM /W:0 /R:1 /XJ /NFL /NDL >> C:\robo_backup.log
REM robocopy "E:\Stuff" "T:\Backup\E\Stuff" /MIR /IM /W:0 /R:1 /XJ /NFL /NDL >> C:\robo_backup.log

Note that if you do NOT want any files deleted in your backup, you should remove /MIR and add /E. The benefit is that if you accidentally delete a file on your C:, and your backup runs, that file will still exist on your backup drive.

The drawback is that every now and then, you may need to clean up old files on your backup drive – or run the script once with /MIR (or its equivalent /E /PURGE) to delete old files – then change it back to just /E.

Despite the inclusion of /XJ, special windows folders will be backed up properly. For example, if you back up C:\Users\Scottie, that will include your Desktop, Music, Pictures, etc.

You can also back up to a network path, like: \\STORAGE\public\Backups

For network attached storage, it’s best if it’s also using the NTFS file system. If it’s a linux-formatted drive, you may need to do a test and make sure things work correctly with timestamps and such.

For NAS linux drives, I usually just format them as NTFS and use the ntfs-3g package to make the Windows puters on the network happy.

That’s all, folks. Enjoy your robust, fast, pro backup!!

Need help? Hire me!
Get Scottie Stuff!