Windows Network Backup Script

By | March 10, 2015

A simple Network Backup Script for windows.

This script uses synctoy to backup data from your local computer to a remote network drive.

Run this script every time you want to backup your data to your remote drive.

Find out more about using synctoy

Network Backup Script

Copy the below script into a text editor and save as a .bat file, e.g. “backup.bat”.

Change the example path from “\\ad\data\Research\spintronics” to the one on your remote network drive.

net use P: \\ad\data\Research\spintronics
REM You should be prompted for password
REM For your user name use ad\<your username>
"C:\Program Files\SyncToy 2.1\SyncToyCmd.exe" -R
net use P: /delete

The first line maps the network drive specified in your network path to the drive letter P. I’ve picked P, but you can use any spare drive letter.

You can just use this part of the script, and manually copy across your files to the remote directory, but I think it makes much more sense to automate the process.

The second command does a backup using synctoy, a synchronisation program from Microsoft. This will synchronise your local folder with a remote one on the network drive.

Make sure you have downloaded and installed synctoy for this script to work properly.

Finally, the script closes your connection to the network drive.