Newsletter
March 1998
9803
*** ERROR *** - Abort, Retry, Fail ?
The February issue of the newsletter contained a bug. (I suspect it came from one of those new viruses).
In the code example to back up your system files, I used the xcopy command with the /K and /H options. To my surprise I found that the system files were not being copied at all. The xcopy command was complaining about these options. As far as I can tell these options do not exist. I have written the publisher of the book, but have received no response.
The correct procedure to back up all the system files is shown on the previous page. Note the use of the attrib command to remove the s - system and h - hidden flags from the files so they can be copied and then putting them back on so the systems look the way we found them.
I have checked the operation of the new procedure and it works fine. Remember: You must run the procedure in DOS mode or the Registry files will be locked by Win95.
I added @echo off to the top of the file. I recommend that you comment out this line with a semicolon (;) the first few times so you can see what is going on behind the scenes. After that it is nice to see only the echos and any errors. (Another option would be to add a few more pause statements in strategic places so you can control the flow of the action.
If you have any cool Win95 tricks, I would like to hear about them. Please write your article in Windows Write, Wordpad, or MS Works, put it on a floppy disk, and give it to any of the officers at a Group meeting.
Mark Pendergast
@ECHO OFF
C:
IF "%1"=="" GOTO BADDEST
IF EXIST C:\BACKUP\%1 GOTO BADDIR
ECHO CREATE DIRECTORY C:\BACKUP\%1 ...
MKDIR C:\BACKUP\%1
ECHO BACKING UP FILES TO C:\BACKUP\%1 ...
ATTRIB -S -H C:\WINDOWS\SYSTEM.DAT
XCOPY C:\WINDOWS\SYSTEM.DAT C:\BACKUP\%1\
ATTRIB +S +H C:\WINDOWS\SYSTEM.DAT
ATTRIB -S -H C:\WINDOWS\USER.DAT
XCOPY C:\WINDOWS\USER.DAT C:\BACKUP\%1\
ATTRIB +S +H C:\WINDOWS\USER.DAT
XCOPY C:\WINDOWS\WIN.INI C:\BACKUP\%1\
XCOPY C:\WINDOWS\SYSTEM.INI C:\BACKUP\%1\
XCOPY C:\WINDOWS\PROTOCOL.INI C:\BACKUP\%1\
XCOPY C:\CONFIG.SYS C:\BACKUP\%1\
XCOPY C:\AUTOEXEC.BAT C:\BACKUP\%1\
ATTRIB -S -H C:\IO.SYS
XCOPY C:\IO.SYS C:\BACKUP\%1\
ATTRIB +S +H C:\IO.SYS
ATTRIB -S -H C:\MSDOS.SYS
XCOPY C:\MSDOS.SYS C:\BACKUP\%1\
ATTRIB +S +H C:\MSDOS.SYS
;
REGEDIT /L:C:\WINDOWS\SYSTEM.DAT /R:C:\WINDOWS\USER.DAT /E C:\BACKUP\%1\REG.TXT
DIR C:\WINDOWS /A-D /ON > C:\BACKUP\%1\WINDIR.TXT
DIR C:\WINDOWS\SYSTEM /A-D /ON > C:\BACKUP\%1\WINSYDIR.TXT
DIR C:\BACKUP\%1
GOTO END
;
:BADDEST
ECHO *ERROR* NO DESTINATION SPECIFIED !!!
GOTO END
;
:BADDIR
ECHO *ERROR* DESTINATION EXISTS, PLEASE DELETE IT !!!
DIR C:\BACKUP\%1
GOTO END
;
:END
PAUSE
Return to the Archive