An Easy Windows Backup Script.

I needed a way to backup all my important files to a server in case I had a hard disk failure. To do this I did not need any special software, just a spare machine (old machines are good for this) or a NAS (Network Attached Storage) or an external hard disk.

# If Network Attached Storage / Spare PC
# use this to create connection to this machine
net use * /d /y
net use z: \\{Server Ip Adderess}\{share name} /user:{username] {password}# use the xcopy command
# /e - copies directories
# /d - copies new files
# /y - suppresses yes/no prompt
# /c - continues even if errors occur
xcopy "{Source Directory}" "z:\{Target Directory}" /e /d /y /c

That’s it. I have been using this for years and it has never failed me. So just create a file called backup.bat someplace on your hard drive, then schedule a task, and that’s it.