You must already know how to use batch commands to use this page. I accept
You can create a Batch program in a Windows system to back up your personal files easily and quickly. This is an alternative to running the Windows Backup program in continuous mode. Microsoft Windows includes a "batch" command language with an XCOPY command that you can use to copy files such as your email, address books, and bookmarks that change daily. Then create a "shortcut" of the .bat file on your Desktop. You can even run it automatically once a day using the Windows Task Scheduler.
If you are using Windows 7, you can backup entire folders using ROBOCOPY instead of this method.
Creating a Batch program:
You must edit all file paths in the sample batch program to match the location of your particular files.
Test your program:
Run COPYFILES.BAT and test each copy operation. Once the program is tested several times with updated files, you may delete the confirmation prompt /P in command lines.
A file called COPY.TXT is created in the same folder as COPYFILES.BAT to log the files that are copied. A new log file is created using >COPY.TXT (and appends to that file using >>COPY.TXT). This log file is overwritten each time you run COPYFILES.BAT and can help you identify typos or other problems.
Batch program to Copy your important Folders (Windows 7)
Windows 7 has a very useful tool called "ROBOCOPY" that can backup all the files in an entire folder. It uses the same techniques as XCOPY with switches to control the way the copy is carried out. Here is an example - you must edit USERNAME to your user name. Or add any other folders you wish to backup. Notice that the target folder and the command line options are put into environment variables, which makes it easy to add new commands. To see all the command line options, open up a "Command Line" windows (or run "%windir%\system32\cmd.exe") and type "ROBOCOPY /?". If you want to save the output to a file, type "ROBOCOPY /? > C:\Users\USERNAME\Documents\ROBOCOPY-info.txt".
How to Zip up every file in a folder
For 7-Zip fans, here is a batch program that will zip all files in "My Documents" and creates the file Backup_08-02-10.zip using today's date (date format depends on your computer settings). You may edit the path after "CD", and the file wildcard * can be changed to any file type (*.htm*, *.xls, *.log). Get 7-ZIp in our Download page.
for /F "tokens=1-4 delims=/ " %%i in ('date /t') do ( set Date=%%i )
REM Edit the path below to any folder:
CD "C:\Documents and Settings\%username%\My Documents"
"C:\Program Files\7-Zip\7zFM.exe" a -tzip Backup_%Date% *
The PDQ Library is licensed under a Creative Commons Attribution-ShareAlike 3.0 Unported License.