Quick Overview:- This page relates specifically to Windows XP but, with modification, the basic principles can be used in most other versions of Windows. Although Windows has a native ability to make compressed zip-file archives, this isn't easily done from a command line. The use of the 7zip freeware program is and will be thus recommended for making (and restoring from) zip files.
The automated part of backing-up is mostly done here by using "Scheduled Tasks". These are often used to invoke a number of "home made" batch files. Batch files are (usually simple) text files with a .bat file extension that gives them executive status. They are a way of running things from the Command Prompt without actually entering any text at the prompt. Once made functional it is easy to re-use them again and again either manually or by calling them from something else. They are really not that difficult to produce but the syntax must be absolutely spot on. They can usually be simply edited by right clicking on them and choosing the edit option. Another way is to drag-n-drop them onto Notepad or a Notepad shortcut.
xcopy c:\source d:\destination /s /e /h /i /y
xcopy %1 %2 /s /e /h /i /y
Backup.bat c:\source d:\destination
C:\FolderToBeBackedUp\
7Za a backup.zip @ListOfFoldersFile
7Za a "E:\backups\backup.zip" @7Zbackup.txt
7Za a "E:\backups\%date:~-4,4%%date:~-7,2%%date:~-10,2%.zip" @7Zbackup.txt
7za x "C:\Backups\*.zip" -o"C:\Program Files\Application\" -r
rem (rd = remove directory) (/s = including all its contents) rem (rd /q = without any prompting) rem (rd /s /q is similar to the old deltree command) rem (7za x and -r extracts the whole contents recursively retaining structure) rem DO NOT have a trailing backslash after folders for Windows commands rem TO HAVE a trailing backslash after folders for 7Zip commands set childfolder="C:\Program Files\Application\Data" set parentfolder="C:\Program Files\Application\" set zipfile="C:\Backups\*.zip" cls @echo off echo CLOSE THIS COMMAND PROMPT IF YOU DO NOT WANT TO PROCEED echo The directory %childfolder% will be deleted if you press any key. PAUSE rd /s /q %childfolder% echo READY TO RESTORE FROM .ZIP FILE echo ENSURE THERE IS JUST ONE BACKUP ZIP FILE in %zipfile% PAUSE 7za x %zipfile% -o%parentfolder% -r