On Tuesday, November 22, 2005, 10:42:26, MFPA wrote:
> Having read a couple of previous threads on the subject, I intend
> to use the following batch files to automate backing up of TB!'s
> registry entries and mail and program directories.

I like to include the date in the backup file name and have made a cmd
file for my everyday backups. I use WinZip's command line interface, but
in principle this should work with anything:

--------------8<--------------snip-----------------------------

:: backup script for windows registry keys and some files
:: with date in backup filename

:: Build a time (dts) variable
:: Using for/do, pull apart the output of date/t
set parsearg="eol=; tokens=1,2,3* delims=., "
for /F %parsearg% %%i in ('date/t') do set dts=%%k%%j%%i

:: set program paths and folder locations
set winzipcall=%PROGRAMFILES%\WinZip\wzzip
set regeditcall=%SYSTEMROOT%\regedit
set xcopycall=%SYSTEMROOT%\system32\xcopy
set backupdir=E:\backup\automated
set backupfile=%backupdir%\cumulative_%dts%.zip

:: registry backups
%regeditcall% /e "%TMP%\thebat.reg" "HKEY_CURRENT_USER\Software\RIT"
%regeditcall% /e "%TMP%\putty.reg" "HKEY_CURRENT_USER\Software\SimonTatham"
%regeditcall% /e "%TMP%\agent.reg" "HKEY_CURRENT_USER\Software\Forte"
%regeditcall% /e "%TMP%\opera.reg" "HKEY_CURRENT_USER\Software\Opera Software"
%regeditcall% /e "%TMP%\k9.reg" "HKEY_CURRENT_USER\Software\KeirNet\"
%regeditcall% /e "%TMP%\all_registry.reg" 
%winzipcall% -a -t -en %backupfile% "%TMP%\*.reg"

:: Miranda IM
%xcopycall% "%APPDATA%\Miranda\roman.dat" "%TMP%\" /y 
%winzipcall% -a -en %backupfile% "%TMP%\roman.dat"

:: The Bat
%winzipcall% -a -en -r -P %backupfile% "%APPDATA%\The Bat!"

:: Agent
%winzipcall% -a -en -r -x00*.* -P %backupfile% "%APPDATA%\Agent\Kawo2"
%winzipcall% -a -en -r -x00*.* -P %backupfile% "%APPDATA%\Agent\Comcast"
::%winzipcall% -a -en -r -x00*.* -P %backupfile% 
"%APPDATA%\Agent\Comcast_Binary"

:: Opera
%winzipcall% -a -en -r -P %backupfile% "%APPDATA%\Opera\Opera\Opera6.adr" 
"%APPDATA%\Opera\Opera\Opera6.ini" "%APPDATA%\Opera\Opera\notes.adr" 
"%APPDATA%\Opera\Opera\wand.dat"

:: SharpReader
%winzipcall% -a -en -r -P %backupfile% "%APPDATA%\SharpReader"

:: Skype
%winzipcall% -a -en -r -P %backupfile% "%APPDATA%\Skype"

:: Putty
%winzipcall% -a -en -r -P %backupfile% "%APPDATA%\Putty"

:: K9 AntiSpam
%winzipcall% -a -en -r -P %backupfile% "%PROGRAMFILES%\K9 AntiSpam"

:: PasswordSafe
%winzipcall% -a -en -r -P %backupfile% "%APPDATA%\PasswordSafe"

:: Total Commander
%winzipcall% -a -en -r -P %backupfile% "%APPDATA%\totalcmd"

:: Outlook
%winzipcall% -a -en -P %backupfile% "%USERPROFILE%\Lokale 
Einstellungen\Anwendungsdaten\Microsoft\Outlook\Outlook.pst"

:: clean up
del "%TMP%\*.reg"


::  Usage: wzzip [options] zipfile [EMAIL PROTECTED] [files...] For information 
on the 
::  zipfile, listfile, and files components, see Using WZZIP. The options are:
::  
::  
::  -a  Add files (default action).
::  
::  Related option  
::  
::  -a+ Remove the archive attribute from each file after adding it to the Zip 
file. 
::  As WinZip« adds a file during the zipping process, the file's archive 
attribute 
::  is reset.
::  
::  Related options      
::  
::  -b[drive|path]      Use another drive for the temporary Zip file. Since 
WZZIP 
::  creates a new, temporary Zip file when it updates a file, sufficient space 
must 
::  be available on the current drive for that file. This option enables you to 
use 
::  another drive for that purpose when space considerations force the issue. 
-c        
::  Create or edit existing comments for all the files in the Zip file.
::  
::  Related options    
::  
::  -C  Create comments only for files being added that are not already in the 
Zip 
::  file.
::  
::  Related options    
::  
::  -d  Delete specified file(s) from the Zip file. -e<e|x|n|f|s|0>     Set the 
::  compression level.  -ee = enhanced deflate method (requires WinZip 8.1 or 
::  higher, WinZip Command Line Support Add-On 1.1 or higher, or a compatible 
Zip 
::  utility to extract); -ex = maximum; -en = normal; -ef = fast; -es = super 
speed; 
::  -e0 = no compression -f     Freshen: replace files that are already part of 
the Zip 
::  file and are newer on disk.
::  
::  Related option  
::  
::  -h|-?       Show this help file -i[-]       Add files whose archive 
attribute is set.  By 
::  default the archive attribute is then removed.  Use the optional "-" suffix 
to 
::  leave the archive attribute on.
::  
::  Related options      
::  
::  -jhrs       Do not store hidden, read only, and system attributes in the 
Zip file.  (-
::  whs controls whether hidden and system files are added.)
::  
::  Related options        
::  
::  -Jhrs       Store hidden, read only, and system attributes in the Zip file 
(default). 
::  (-whs controls whether hidden and system files are added.)
::  
::  Related options        
::  
::  -k  Do not update the Zip file's file date; retain the original date.
::  
::  Related option  
::  
::  -m[f|u]     Move files to the Zip file.  When the Add|Freshen|Update 
operation is 
::  complete, the original files are deleted.
::  
::  Related option  
::  
::  -o  Change the Zip file's file date to the same as the newest file in the 
Zip 
::  file.
::  
::  Related options   
::  
::  -p|P        Store folder names.  A lower case p stores only the names of 
folders 
::  recursed (subfolders included) via the -r option, while an upper case P 
stores 
::  all folder information specified on the command line.
::  
::  Related option  
::  
::  -q  Display ANSI control codes within comments (ansi.sys must be present).  
This 
::  option affects display only; it does not strip ANSI codes while creating a 
::  comment.  Note: ansi.sys is not supported under Windows NT 4.0. -r  Recurse 
into 
::  subfolders (include subfolders).  This option requires the -p or -P option.
::  
::  Related option  
::  
::  -s[password] Specify a password (if no password is given, a prompt will be 
::  generated).  Passwords containing spaces must be enclosed in double quotes. 
::  Please read this important information About Encrpytion. (-yc can be used 
to 
::  change the encryption method to one of the AES encryption methods)
::  
::  Related option  
::  
::  -t[f|d][date] Include files with a date equal to or more recent than the 
date 
::  specified (current date if no date specified).
::  
::  Date formats without the f modifier depend on country settings; examples 
with 
::  and without delimiters: United States: mmdd[yy]yy or [m]m/[d]d/[yy]yy 
Japan: 
::  [yy]yymmdd or [yy]yy/[m]m/[d]d Most of Europe: ddmm[yy]yy or 
[d]d.[m]m.[yy]yy 
::  valid delimiters are / . or - The f modifier indicates that the date is 
::  specified in either of the following country-independent formats, 
regardless of 
::  the system's locale settings: [yy]yymmdd [yy]yy-[m]m-[d]d 
::  
::  Note that years can be specified as two or four digits.  Two-digit years 
less 
::  than 80 are assumed to be 20##, while two-digit dates greater than or equal 
to 
::  80 are assumed to be 19##. The d modifier indicates that the date specified 
is 
::  the number of days elapsed instead of a specific date.
::  
::  Related option  
::  
::  -T[f|d][date] Include files older than the date specified (current date if 
no 
::  date specified)
::  
::  Date formats without the f modifier depend on country settings; examples 
with 
::  and without delimiters: 
        United States: mmdd[yy]yy or [m]m/[d]d/[yy]yy Japan: 
::  [yy]yymmdd or [yy]yy/[m]m/[d]d Most of Europe: ddmm[yy]yy or 
[d]d.[m]m.[yy]yy 
::  valid delimiters are / . or - The f modifier indicates that the date is 
::  specified in either of the following country-independent formats, 
regardless of 
::  the system's locale settings: [yy]yymmdd [yy]yy-[m]m-[d]d 
::  
::  Note that years can be specified as two or four digits.  Two-digit years 
less 
::  than 80 are assumed to be 20##, while two-digit dates greater than or equal 
to 
::  80 are assumed to be 19##. The d modifier indicates that the date specified 
is 
::  the number of days elapsed instead of a specific date.
::  
::  Related option  
::  
::  -u  Update: add files that are new or have changed.  This command adds to 
the 
::  Zip file any files that are not already in the Zip file, and replaces any 
files 
::  that have a more recent date on disk.  Put another way, this command is the 
same 
::  as -a (Add) except that it skips files that are already in the Zip file and 
have 
::  the same date in the Zip file and on disk.
::  
::  Related option  
::  
::  -v[b|t][r][m][c][d|e|n|o|p|s][f] View the list of files in the Zip file in 
one 
::  of the following formats: normal, brief, or technical.  r reverses the sort 
::  order, m (more) pauses after each screen, and c displays any file comment.  
You 
::  can optionally sort by date, extension (file type), name, original order, 
::  percentage compression, or uncompressed size.  The f option causes the date 
to 
::  be displayed in the format yyyy-mm-dd regardless of the local system's 
display 
::  settings.
::  
::  Related options    
::  
::  -vi[m]      View the Zip file's internal information.  Use the optional "m" 
suffix 
::  to prevent text from scrolling off the screen.
::  
::  Related options    
::  
::  -whs        Include hidden and system files in the zipping process.
::  
::  Related options      
::  
::  -Whs        Exclude hidden and system files from the zipping process 
(default).
::  
::  Related options      
::  
::  -x<filename> Exclude the specified file(s) from the zipping process.  
Wildcards 
::  are allowed.
::  
::  Related options      
::  
::  [EMAIL PROTECTED] Exclude the files listed in the specified listfile from 
the zipping 
::  process.  This listfile uses the same format as the listfile used to 
specify 
::  files to be zipped (see Using WZZIP).
::  
::  Related options      
::  
::  -yb[c]      Automatic, non-interactive ("batch" mode) handling of prompts.  
If a 
::  prompt is issued, the operation terminates with error level 250.  Use the 
::  optional c suffix to automatically continue with a "yes", "ok" response 
instead 
::  of terminating. -yc[AES|AES128|AES256]      Override the default Zip 2.0 
standard 
::  encryption method used by the -s command. (requires WinZip 9.0 or higher, 
WinZip 
::  Command Line Support Add-On 1.1 or higher, or a compatible Zip utility to 
::  extract); The -yc command must be entered after the -s command. -yc, - 
ycAES, 
::  and -ycAES128 all change the encryption method to WinZip's 128-bit AES 
::  encryption. -ycAES256 changes the encryption method to WinZip's 256-bit AES 
::  encryption. Please read this important information About Encryption.
::  
::  Related option  
::  
::  -yk Force the use of MS-DOS (8+3) filenames within the Zip file. -yp        
Display a 
::  "Press any key to continue" prompt when the operation completes.  This is 
::  particularly useful when running WZZIP from Start Menu's Run dialog box or 
from 
::  the "start" command. -ys[size]<filename> Split an existing Zip file into 
::  separate files of a specified size. The name of each separate file will be 
based 
::  on the name used for the destination filename. The size is the number of 
KBs for 
::  each file. 
::  
::  If the size is omitted, the function is similar to the span option and the 
::  destination filename must be on a removable disk. Each removable disk 
except for 
::  the first will have any files deleted from it before the spanned Zip file 
is 
::  written. For more information see Splitting Zip Files.
::  
::  Related option   
::  
::  -yt[date]   Change the date and time for all files in a Zip file to the 
current 
::  date and time or the specified date and time. If the date is omitted the 
current 
::  date and time is used.  The date and time format is mmddHHMM[yyyy]. If the 
year 
::  is omitted, the current year is used. The hour, HH, must be specified in 24 
hour 
::  notation.
::  
::  Related option  
::  
::  -z  Create or edit a Zip file comment.
::  
::  Related options    
::  
::  -&[w] [s[drive]] Span to multiple removable disks.  Use the optional w 
suffix to 
::  wipe out all files on the removable disk.  Use the optional s suffix to zip 
up 
::  an entire disk with subfolders.
::  
::  (Windows NT/2000/XP users must specify "-&" or -^& due to cmd.exe 
requirements)
::  
::   Related options   
::  
::  -$[drive]   Save volume label as a part of the Zip file; the current drive 
is used 
::  if not otherwise specified. [EMAIL PROTECTED]      Create a file listing 
all the files that 
::  would be archived if this option were not specified. Hint: remember to use 
the 
::  leading dash to create a list.  Leave out the leading dash to use a list of 
::  files in a WZZIP command.
::  
::  Related options    
::  
::  -^  Display the command line on your screen 
::  
::  (Windows NT/2000/XP users must specify "-^" or -^^ due to cmd.exe 
requirements)

--------------8<--------------snip-----------------------------

Note that building the DTS variable is different on English systems.

Regards,
Roman



-- 



________________________________________________
Current version is 3.62.14 | 'Using TBUDL' information:
http://www.silverstones.com/thebat/TBUDLInfo.html

Reply via email to