Quick and Easy Backup Batch File Windows

Backups are an evil necessity and as with most geek admins we tend to forget to do it. We think of grand schemes and how we can do it better. Well I am still thinking of those grad schemes but in the meantime I use a simple command file to backup file off one drive to another that will only copy newer files. What is so nice with this is I don’t have to have a backup program to retrieve the data, but the drawback is that it uses alot of space. Running it the first time will back them all up but future runs are fast.

The batch file uses xcopy as the start with several switches, displays it in colored backgrounds and writes a logfile when it is done. Here is the simple backup.

That’s all there is to it. To add more directories just copy one of the lines and change the directory names. For further automation use Windows Scheduled Tasks to add the command to run behind the scenes. You can do this the GUI way or command line. My preference is at the command line.

This example shows to run it weekly

schtasks /Create /SC WEEKLY /TN Backup /ST 03:00 /TR c:\scripts\myback.cmd

Now we are set. For the initial backup you can double click on the command file and watch it run. Then the scheduled task will run much faster.



3 Responses to “Quick and Easy Backup Batch File Windows”

  1. Colin says:

    I get errors when I run this. ‘gt’ is not recognised and I can’t see anywhere that it gets set in the batch file.

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.