forum.vdsworld.com Forum Index forum.vdsworld.com
Visit VDSWORLD.com
 
 FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 


System Back-up Utility

 
Post new topic   Reply to topic    forum.vdsworld.com Forum Index -> Visual DialogScript 3 Source Code
View previous topic :: View next topic  
Author Message
Dr. Dread
Professional Member
Professional Member


Joined: 03 Aug 2001
Posts: 1065
Location: Copenhagen, Denmark

PostPosted: Sun Jan 13, 2002 2:27 pm    Post subject: System Back-up Utility Reply with quote

This proggie makes a back-up of some of the most important system files + the Registry. It's bin tested with Win9x and WinME - XP has its own similar utility, I'm not sure if this program works with WinNT & W2K.

Use the program to make frequent system back-ups, for instance by placing the program in your startup folder. It will use an INI-file to check if it has been run already that day. If yes, it will just exit - if no, it will make an archive with the system and registry files. It keeps the 3 most receps back-up archives.

First of all you will need the DOS version of PKZIP + PKUNZIP - I recommend the freely obtainable v. 2.50 - use this link if you need it:
ftp://ftp.pkware.com/PK250DOS.EXE
Then create a backup directory, preferably a DOS compatible 8.3 name, such as C:\Backup
Here you place PKZIP.EXE and PKUNZIP.EXE plus your compiled VDS backup program. Then run the program, and it will create its INI file in the Win-dir and a file called RESTORE.BAT in the root dir plus collect the necessary files from your system - these files are rounded up in the program's own directory.
Before using the program for a restore, I would suggest checking that the backup has made the relevant zip files in the back-up directory (these back-up zip files are named SYSBAK#1 etc.). Check to see that all files are in the zip file - for the complete list of files supposed to be there, check the file incl.lst in your back-up directory.

If your system is screwed up, for instance by installing some software or hardware that has messed up your system, you may restore your system files to their previous state by using the restore facility. Restart your computer with a bootable floppy or in MS-DOS mode - DO NOT use a Windows MS-DOS prompt! Then type RESTORE [enter] - this will start the batch file RESTORE.bat in the root dir of your C drive. Follow the on-screen instructions.

Sounds tricky? Well, it's not. I have used it lots of times on different computers without any mishaps - you may test the RESTORE command, as it will warn you before starting to overwrite (restore) your system files.

Here is the code:

Code:


   Title System Back-Up

REM Get ZIP package from ftp://ftp.pkware.com/PK250DOS.EXE if you need it!
   
:INITIAL
   %W = @WINDIR()
   REM Check if pkzip & pkunzip are present
   GOSUB CHECKZIP
   REM Check if INI-file exists
   IF @FILE(%W\SYS-BACK.ini)
      GOTO READINI
   REM If not - create it
   ELSE
      LIST CREATE,3
      LIST ADD,3,[PARAM]
      LIST ADD,3,date=010199
      LIST ADD,3,delay=10
      LIST SAVEFILE,3,%W\SYS-BACK.ini
      LIST CLOSE,3
      WAIT 1
   END
   GOTO READINI

:READINI
   %S = @CURDIR()
   %F = SYS_BACK.zip
   %L = @datetime(ddmmyy)
   INIFILE OPEN,SYS-BACK.INI
   %H = @INIREAD(PARAM,date)
   %T = @INIREAD(PARAM,delay)
   REM Check if Back-up program has been run today
   IF @EQUAL(%H,%L)
   EXIT
   ELSE
      GOSUB MAKEFILES
      GOSUB RUN
      GOSUB COPYFILES
   END
   INIFILE WRITE,PARAM,date,%L
END
EXIT

REM ************************
REM   ---- SUBs ----
REM ************************

:CHECKZIP
IF @NULL(@FILE(PKZIP.EXE))
INFO You must place zip program PKZIP.EXE in program directory @CR() Program exits now!
STOP
END
IF @NULL(@FILE(PKUNZIP.EXE))
INFO You must place unzip program PKUNZIP.EXE in program directory @CR() Program exits now!
STOP
END
EXIT

:COPYFILES
IF @NULL(@FILE(CHOICE.COM))
   FILE COPY, %W\COMMAND\CHOICE.COM, %S\CHOICE.COM
END
IF @NULL(@FILE(ATTRIB.EXE))
   FILE COPY, %W\COMMAND\ATTRIB.EXE, %S\ATTRIB.EXE
END
IF @NULL(@FILE(deltree.EXE))
   FILE COPY, %W\COMMAND\DELTREE.EXE, %S\DELTREE.EXE
END
LIST CREATE,6
LIST LOADFILE,6,%W\SCANREG.INI
%M = @MATCH(6,Optimize)
LIST PUT,6,Optimize=0
LIST SAVEFILE,6,%S\SCANREG.INI
LIST CLOSE,6
EXIT

:MAKEFILES
LIST CREATE,1
LIST ADD,1,"@echo Off"
LIST ADD,1,cd\
LIST ADD,1,cd %S
LIST ADD,1,cls
LIST ADD,1,Echo Directory changed from root to %S
LIST ADD,1,Echo To initiate the restore use command:
LIST ADD,1,Echo
LIST ADD,1,Echo        RESTORER [Back-Up filename]
LIST ADD,1,Echo
LIST ADD,1,Echo Usually you should use the newest back-up file
LIST ADD,1,Echo This is a list of Back-Up files found in %S
LIST ADD,1,Echo ****************************************************************
LIST ADD,1,Echo
LIST ADD,1,dir /o-d *.zip
LIST SAVEFILE,1,C:\restore.bat
LIST CLOSE,1
LIST CREATE,2
LIST ADD,2,"@echo off"
LIST ADD,2,ECHO This is a DOS batch file created by Dr. Dread's System BackUp
LIST ADD,2,Echo
LIST ADD,2,ECHO **********************************************************
LIST ADD,2,ECHO             !!! WARNING  WARNING !!!
LIST ADD,2,ECHO   !!! DO NOT RESTORE FROM A WINDOWS DOS PROMPT  !!!
LIST ADD,2,ECHO !!! RESTART IN MS-DOS MODE OR USING A START DISK !!!
LIST ADD,2,ECHO **********************************************************
LIST ADD,2,Echo
LIST ADD,2,Echo
LIST ADD,2,Echo
LIST ADD,2,if "%1".==. goto parametererror
LIST ADD,2,if not exist "%1" goto error1
LIST ADD,2,Echo This batch program will restore your system files from "%1"
LIST ADD,2,Echo Press Y to perform the restore or N to leave this program.
LIST ADD,2,CHOICE /C:YN
LIST ADD,2,IF ERRORLEVEL 2 GOTO quit
LIST ADD,2,IF ERRORLEVEL 1 GOTO RESTORE
LIST ADD,2,:RESTORE
LIST ADD,2,CD\
LIST ADD,2,CD %S
LIST ADD,2,MD RESTORE
LIST ADD,2,Pkunzip -o %S\"%1" %S\RESTORE\
LIST ADD,2,Echo on
LIST ADD,2,Attrib %W\System.dat -r -s -h
LIST ADD,2,Attrib %W\User.dat -r -s -h
LIST ADD,2,Attrib C:\Io.sys -r -s -h
LIST ADD,2,Attrib C:\Msdos.sys -r -s -h
LIST ADD,2,Copy %S\RESTORE\Win.ini %W
LIST ADD,2,Copy %S\RESTORE\System.ini %W
LIST ADD,2,Copy %S\RESTORE\System.dat %W
LIST ADD,2,Copy %S\RESTORE\User.dat %W
LIST ADD,2,Copy %S\RESTORE\Command.com %W
LIST ADD,2,Copy %S\RESTORE\Protocol.ini %W
LIST ADD,2,Copy %S\RESTORE\Msdos.sys C:\
LIST ADD,2,Copy %S\RESTORE\Io.sys C:\
LIST ADD,2,Attrib %W\System.dat +r +s +h
LIST ADD,2,Attrib %W\User.dat +r +s +h
LIST ADD,2,Attrib C:\Io.sys +r +s +h
LIST ADD,2,Attrib C:\Msdos.sys +r +s +h
LIST ADD,2,Copy %S\RESTORE\Dosstart.bat %W
LIST ADD,2,Copy %S\RESTORE\Autoexec.bat C:\
LIST ADD,2,Copy %S\RESTORE\Config.sys C:\
LIST ADD,2,Copy %S\SCANREG.INI %W
LIST ADD,2,IF EXIST %W\Wnbootng.sts Deltree /y %W\Wnbootng.sts
LIST ADD,2,Deltree /y %S\RESTORE\*.*
LIST ADD,2,Echo OFF
LIST ADD,2,ECHO Restore performed from "%1"
LIST ADD,2,ECHO Use Ctrl+Alt+Del to restart your computer
LIST ADD,2,goto quit
LIST ADD,2,:parametererror
LIST ADD,2,cls
LIST ADD,2,Echo You did not state the name of the back-up file!!!"
LIST ADD,2,Echo Use the command:"
LIST ADD,2,Echo RESTORER [filename]
LIST ADD,2,Echo
LIST ADD,2,Echo
LIST ADD,2,goto quit
LIST ADD,2,:error1
LIST ADD,2,cls
LIST ADD,2,echo Cannot find file "%1"
LIST ADD,2,echo Correct the error and try again
LIST ADD,2,echo
LIST ADD,2,echo
LIST ADD,2,echo
LIST ADD,2,goto quit
LIST ADD,2,:quit
LIST ADD,2,goto end
LIST ADD,2,:end
LIST SAVEFILE,2,%S\restorer.bat
LIST CLOSE,2
LIST CREATE,3
LIST ADD,3,C:\io.sys
LIST ADD,3,C:\config.sys
LIST ADD,3,C:\autoexec.bat
LIST ADD,3,C:\msdos.sys
LIST ADD,3,%W\command.com
LIST ADD,3,%W\protocol.ini
LIST ADD,3,%W\User.dat
LIST ADD,3,%W\System.dat
LIST ADD,3,%W\win.ini
LIST ADD,3,%W\system.ini
LIST ADD,3,%W\dosstart.bat
LIST SAVEFILE,3,%S\incl.lst
LIST CLOSE,3
EXIT

:RUN
WAIT %T
REM Zip the files - use RUNH if you don't want to see DOS window
RUN PKZIP.EXE -whs %F "@incl.lst"
REPEAT
UNTIL @winexists(PKZIP)
%g = @winexists(PKZIP)
GOSUB WAITLOOP
Window close,%g
REM Delete the oldest back-up file
FILE DELETE,%S\SYSBAK#3.zip
REM And move the others one step backwards
FILE RENAME,%S\SYSBAK#2.zip,%S\SYSBAK#3.zip
FILE RENAME,%S\SYSBAK#1.zip,%S\SYSBAK#2.zip
FILE RENAME,%S\%F,%S\SYSBAK#1.zip
END
EXIT

:WAITLOOP
REPEAT
WAIT 1
    if @WINEXISTS(PKZIP)
    %%wait = 1
    else
    %%wait = 0
    end
UNTIL @EQUAL(%%wait,0)
exit



Greetz
Dr. Dread
Back to top
View user's profile Send private message
Display posts from previous:   
Post new topic   Reply to topic    forum.vdsworld.com Forum Index -> Visual DialogScript 3 Source Code All times are GMT
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
You can attach files in this forum
You can download files in this forum

Twitter@vdsworld       RSS

Powered by phpBB © 2001, 2005 phpBB Group