Hello Thomas, Sunday, May 16, 2004, 4:17:01 AM, Thomas Andersson wrote:
TA> Is there a way to use the Windows scheduler or make TA> The Bat! perform a backup every time I exit the program? Yes is the short answer. The batch file below will create a rotating grandfather, father, and son backup. You may want to copy one set of the backup files (i.e. program & mail base either in zip or 7z format) to another name to create a base line set of files. So here is what I did. 1) Need a compression utility with command line capability. I used 7-Zip, http://www.7-zip.org/, other have used WinRar. 7-Zip is a FREE compression utility. I've test it successfully many times. It has saved my bacon sort to speak a few times. 2) Placed copy of the backup batch file in program directory. It is important to understand this backup batch file backs up all 3 critical areas of TB which are the program directory, the mail directory, and RIT registry in windows. Depending upon what OS you are using (i.e. NT version) you may have to provide additional rights to the user to facilitate backing up ALL 3 critical areas. I use 2 types of users on WinXP Pro which are admin and limited user belonging to power user group. See the batch file below. 3) Create a shortcut to a batch file which starts TB and the backup batch file created in #2 above. It is important that in the shortcut properties in "start in" you put the program directory of TB otherwise TB will run concurrently with the backup. You don't want the backup to start until you exit which the "start in" issue clears up. See the batch file below. Thanks to Marck I've made some changes to his batch file to coincide with my configuration of having my TB program and mail base on separate partitions/drives. I should also state there were some other nuances in Marck's batch file that did not work for me. This maybe how my PC's configured or who knows (ie. my mistake?). I believe Lief also provided some help on programs running concurrently. IIRC Marck's batch creates a base line grandfather which does NOT change. I didn't like this logic because I wanted the rotating version of the grandfather/father/son backup. In response to Marck I should also comment up front that I use the "7z" compression format rather than the "zip" format used in Marck's batch file. So depending upon which compression utility you use you will have to make the appropriate changes to the batch file. Some people use Winrar where I used 7-Zip which is a free compression utility available on the web at http://www.7-zip.org/. Using the 7-Zip compression utility using the UPDATE feature on a mail base of approximately 910 MB and 10 MB of program directory took approximately 4 minutes to do an incremental backup which facilitates backing up on exit. I tested the batch by deleting all remnants of TB from system (ie. program directory, mail directory, & registry) and restoring which also took about 4 minutes on the 910 MB mail base. These times can vary depending upon the change in the mail base. I believe I left echo on as provided by Marck in his original version. However you may want to turn it off after you are confident any changes made work properly for your configuration of TB on your PC. I am the only users on this PC, however IIRC for newer users who have recently installed TB with multiple profiles I believe the mail base changes for each user. So multiple versions of the shortcut and backup file will be required for each user on a PC that desires a backup. ----------#2 Incremental TB Backup Batch File (Name: TBigfs.bat)----->> cd \ Path C:\Windows;C:\Program Files\7-ZIP rem Echo off Echo on Echo ******************************* Echo * !! Updating Backup !! * Echo * !! Archive of TB-Program !! * Echo ******************************* rem set archiver=C:\Program Files\7-Zip\7z.exe set drvPm=c: set drvBU=x: set dstdir=TBArchives\ set srcdirPM=Program files\The Bat!\ set srcdirMl=AppsBase\MAIL\ set archive=b1 :---------------- :loopPgrm set namePgm=%dstdir%tbIcPm%archive%.7z if not exist "%drvBU%\%namePgm%" goto doitPg if "%archive%"=="b4" goto runoutPg if "%archive%"=="b3" set archive=b4 if "%archive%"=="b2" set archive=b3 if "%archive%"=="b1" set archive=b2 goto loopPgrm :---------------- :runoutPg set archDel=b1 set nameDel=%dstdir%tbIcPm%archDel%.7z del %drvBU%\%nameDel% :---------------- :doitPg regedit /e "%drvPm%\%srcdirPM%tbreg.reg" hkey_current_user\software\rit cd \ if "%archive%"=="b4" set prev=b3 if "%archive%"=="b3" set prev=b2 if "%archive%"=="b2" set prev=b1 if "%archive%"=="b1" set prev=b4 %drvPm% cd \ copy %drvBU%\%dstdir%tbIcPm%prev%.7z %drvBU%\%namePgm% 7z u -ms=off %drvBU%\%namePgm% -up0q0r2x1y2z1w2 "%srcdirPM%*" -r %drvPm% cd %srcdirPM% del tbreg.reg cd \ if "%archive%"=="b4" set archDel=b1 if "%archive%"=="b3" set archDel=b4 if "%archive%"=="b2" set archDel=b3 if "%archive%"=="b1" set archDel=b2 set namePgm=%drvBU%\%dstdir%tbIcPm%archDel%.7z del %namePgm% %drvBU% cd \ cd %srcdirMl% Echo ***************************** Echo * !! Updating Backup !! * Echo * !! Archive of TB-Mail !! * Echo ***************************** set archMl=b1 :---------------- :loopMail :---------------- set nameMl=%dstdir%tbIcMl%ArchMl%.7z if not exist "%drvBU%\%nameMl%" goto doitMl if "%archMl%"=="b4" goto runoutMl if "%archMl%"=="b3" set archMl=b4 if "%archMl%"=="b2" set archMl=b3 if "%archMl%"=="b1" set archMl=b2 goto loopMail :---------------- :runoutMl :---------------- set archDlMl=b1 set namDlMl=%dstdir%tbIcMl%archDlMl%.7z del %drvBU%\%namDlMl% :---------------- :doitMl :---------------- cd \ if "%archMl%"=="b4" set prevMl=b3 if "%archMl%"=="b3" set prevMl=b2 if "%archMl%"=="b2" set prevMl=b1 if "%archMl%"=="b1" set prevMl=b4 %drvBU% cd \ copy %drvBU%\%dstdir%tbIcMl%prevMl%.7z %drvBU%\%nameMl% 7z u -ms=off %drvBU%\%nameMl% -up0q0r2x1y2z1w2 "%srcdirMl%*" -r if "%archMl%"=="b4" set archDlMl=b1 if "%archMl%"=="b3" set archDlMl=b4 if "%archMl%"=="b2" set archDlMl=b3 if "%archMl%"=="b1" set archDlMl=b2 set nameMl=%drvBU%\%dstdir%tbIcMl%archDlMl%.7z del %nameMl% %drvPm% cd %srcdirPM% ----------#2 Incremental TB Backup Batch File (Name: TBigfs.bat)-----<< -----------------#3 Batch File TB Shortcut (Name: StartTB.bat) ------>> "C:\program files\the bat!\thebat.exe" Call TBigfs.bat -----------------#3 Batch File TB Shortcut (Name: StartTB.bat) ------<< BTW Marck, one of the things I could not get to work was the variable you set up for the program called "archiver". Anyhow "7z" is much shorter than the variable name, and IIRC 7-Zip is a little fidgety in that you need to compress from the root directory which is fine because to restore all you have to do is indicate the drive because all of the paths are included in the backup. What can I say other than it works for me. -- Best Regards, Greg Strong Using The Bat! v2.11 Beta/9 on Windows XP 5.1 Build 2600 Service Pack 1 The question in life is not whether you will have problems, but how you deal with them. ________________________________________________ Current version is 2.10.03 | 'Using TBUDL' information: http://www.silverstones.com/thebat/TBUDLInfo.html