------------------------------------------ ARC.BAT - - MICRO TRAINER (Langley) by Dr Russell Langley, 5 Chaddesley Ave, Balaclava, Melbourne - - - - - - - - - - - - - - - - - - - - - - - :START @echo off REM ** Omit the @ in previous line if using DOS 3.2 or REM ** earlier. Start by clearing screen. Then check REM ** for presence of C:\WORK, & create it if necessary. cls c: if exist c:\work\nul goto OK cd\ and work :OK cd\work echo TRIPLE ARCHIVING UTILITY echo. echo This program packs &/or unpacks .ARC, .ZIP, & .LZH files. echo. REM ** Choose compression utility, or Quit to exit. :AGAINI READKEY "Tap: (A)rc, (Z)ip, (L)zh, (Q)uit ? " Pgm if %Pgm% == A goto PKARC if %Pgm% == Z goto PKZIP if %Pgm% == L goto LHA if %Pgm% == Q goto END echo No, please tap A, Z, L, or Q. goto AGAIN1 REM ** Branch to selected routine to define variables REM ** pl, p2, p3 in each case. When ustna "set", do NOT REM ** put spaces around the equal character. :PKARC set pl=ARCFILE set p2=pkarc set p3=pkxarc goto SHOWDIR :PKZIP set pl=ZIPFILE set p2=pkzip set p3=pkunzip goto SHOWDIR :LHA set p1=LZHFILE set p2=lha set p3=lha REM ** ARC.BAT creeds all files to be packed, or any REM ** packed file to he unpacked, in C:\work. So REM ** display the contents of C:\work. :SHOWDIR echo. echo DIR C:\WORK echo All Source od Compressed Files must be in C:\Work dir /w echo. REM ** Ofer to copy files from other drives or REM ** directories to c:\work. Readln doesn't like null REM ** entries, so use / (which can't be a filename). READLN *Filespec (wilds) to be copied into C:\WORK (/ = none) - * Fil if %Fil% == / goto PAK_UNPK copy %Fil% c:\work cls goto SHOWDIR REM ** See if the user want to pack or unpack, and branch REM ** appropriately. The variable p1 inserts ARCFILE PAK_UNPK echo. READKEY "Tap: (C)reate/alter %pl%, (E)xtract/read from %pl%, (Q)uit ? " CEQ if %CEQ% == C goto PACK if %CEQ% == E goto UNPACK if %CEQ% == Q goto END echo No, please tap C, E, or Q. goto PAK_UNPK REM ** This part is for compressing normal files or REM ** updating compressed files. Ask for a filename FOR REM ** the new archive, or name OF the existing archive. :PACK echo. READLN "Enter: Name for/of %pl% - - " V1 REM ** Ask user for kind of processing required REM ** (A, U, M, or D). :AGAIN2 READKEY "Tap: (A)dd=create, (U)pdate, (M)ove_into, (D)el_files_from " V2 for %%x in (A U M D) do if %%x == %V2% goto PACKOK echo No, please tap A, U, M, or D. goto AGAIN2 REM ** A valid response V2 has been obtained. What REM ** normal files are to be processed, V3? :PACKOK READLN "Enter: C:\WORK filenames to be processed (e.g. *.*) - - " V3 REM ** Remarkably the syntax for running these 3 REM ** utilities is the same except a sign change is not REM ** done with LHA.Turning "echo on" lets user see REM ** what is happening. if not %pl% == LZHFILE set V2=-$V2$ echo on %p2% %V2% %V1% %V3$ REM ** Turn "echo off" again, and see if user wants to REM ** quit or not. @echo off goto ANYMORE REM ** This part is for examining &/or unpacking REM ** compressed files. Ask for a compressed filename REM **(extension unnecessary) in c:\work. :UNPACK echo. READLN "Enter: Name of PACKED %pl% " V1 REM ** Ask what user wants (T, V, C, or X) & put this REM ** answer in V2. :AGAIN3 READKEY "Tap: (T)est, (V)iew fnames, (C)ontents_see, (X)tract files - - " V2 for %&y in (T V C X) do if %%y == %V2& goto UNOK echo No, please tap T, V, C, or X. goto AGAIN3 REM ** A valid response has been registered. REM ** Now branch to the appropriate command line. REM ** T & V are fairly simple. :UNOK goto UNP*V2% :UNPt if not %pl% == LZHFILE set V2==$V2$ goto UNPtv :UNPv if not %pl% == LZHFILE set V2==%V2% if %pl% == LZHFILE Set V2=1 :UNPtv echo on %p3& %V2% $V1% @echo off goto ANYMORE REM ** This shows the contents of plain text files. REM ** They're going to be shown by piping into the REM ** DOS MORE program (which pauses at each screenful). REM ** What file or files does user want to be displayed? :UNPc READLN "Enter: Files (e.g. *.doc) to be displayed - " V3 if not %pl% == LZHFILE set V2==%V2% if %pl% == LZHFILE set V2=p echo on %p3,% %V2% %V1% &V3% | more @echo off goto ANYMORE REM ** The eXtract (unpack) option lands here. REM ** Find out which files are to be unpacked. :UNPx READLN "Enter: %vl% files to be extracted (ALL=*.*) - " V3 if %V3% == ALL set V3=*.* if not %pl& == LZHFILE set V2==%V2% echo on %p3% %V2% %V1% %V3$ @echo off REM ** Virus signatures are distorted by compression REM ** techniques,, so it is wise to check unpacked files REM ** at the earliest moment. The above routine passes REM ** straight on to the following question, and scans REM ** them if you tap Y. Any response except Y, y, N, or REM ** n causes the question to be repeated. :VIRTESTecho. READKEY "Do you want the UNPACKED files tested for VIRUSES (y/n)?" Vir if %Vir% == N goto ANYMORE if not %Vir% == Y goto VIRTEST echo Ok, testing ... scan c:\work echo If infected, press Ctrl+Break & kill virus, else ... pause :ANYMORE echo. READKEY "Tap: (S)tart afresh, (D)ir c:\work, (Q)uit ? " SDQ if %SDQ% == S goto START if %SDQ% == D goto SHOWDIR if %SDQ% == Q goto END REM ** Finally, always delete all the environment REM ** variables. When typing these, just press Enter REM ** immediately after each equals sign. :END set pl= set p2= set p3= set V1= set V2= set V3= set Pgm= set Fil= set CEQ= set Vir= set SDQ= REM ** Some people might need a reminder to tidy REM ** up c:\work at this point.