Category : Batch File Utilities - mostly for DOS
Archive   : CHK_VL.ZIP
Filename : CHK_VL.DOC

 
Output of file : CHK_VL.DOC contained in archive : CHK_VL.ZIP

I. Purpose of CHK_VL

In writing software to be used by others, I've had to create an
Installation Routine from time to time in a DOS command file (ie, a
.BAT file). All was going fine until I was working on a project that
required MORE than 1 floppy to install the package. During testing,
one guy was busy talking and forgot to switch disks when prompted.
Needless to say, the installation was not successful. Sooo, I tagged
each floppy in the set with a unique volume label, and wrote this
little program to let my INSTALL.BAT file test to see if the right
disk has been placed in the drive.

II. How to use CHK_VL

To get on-line help with CHK_VL, just type: CHK_VL or CHK_VL ?

In general:

USAGE: CHK_VL label [disk] [> NUL:]

where "label" is the Volume Label to check for.
"disk", if supplied, is the disk to check.
If not supplied, CHK_VL checks the
current disk.

RETURNS: A Match-Status message string
(For BAT file use, msg can be
suppressed if use "> NUL:" to
send output to NUL.)
Errorlevel = 0 if Volume Label matches "label"
Errorlevel = 1 if Volume Label does NOT match

For example, to check to see if the current disk's label is SYSTEM,
the command would be:

CHK_VL system


To check to see if the label on the disk in drive B: is SETUP,
the command would be:

CHK_VL setup b:


A. Using CHK_VL from the DOS prompt

If you use CHK_VL from the DOS prompt without redirecting the output
to the NUL device, CHK_VL will echo back either one of two messages.

The Volume Label matches.
or
The Volume Label DOES NOT match.


B. Using CHK_VL within a BAT file

Normally, you do NOT want status messages appearing from commands in
a BAT file. Therefore, CHK_VL supports redirection of all messages to
the NUL device. CHK_VL will STILL return the proper DOS ERRORLEVEL
value to be tested by your BAT file.

For example, say you had to deal with two installation disks, a Setup
Disk and a Program Disk. The skeleton for an INSTALL.BAT for this
situation starts on the following page. A copy of INSTALL.BAT and a
copy of CHK_VL.EXE must be on EVERY disk in the set.

ECHO OFF
REM
REM SAMPLE INSTALL.BAT
REM USING CHK_VL
REM
IF "%1" == "C:" GOTO OK
IF "%1" == "c:" GOTO OK
IF "%1" == "D:" GOTO OK
IF "%1" == "d:" GOTO OK
IF "%1" == "E:" GOTO OK
IF "%1" == "e:" GOTO OK
IF "%1" == "F:" GOTO OK
IF "%1" == "f:" GOTO OK
ECHO 
ECHO  The proper syntax for using INSTALL is:
ECHO 
ECHO  INSTALL drive
ECHO 
ECHO  where "drive" = either C: , D: , E: or F:
ECHO  (the : is REQUIRED)
ECHO 
GOTO END

:ERR1
ECHO 
ECHO ÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ
ECHO  DISK ERROR - Wrong Disk inserted in Drive
ECHO ÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ
ECHO 
ECHO  Either press CTRL-C to abort the Installation,
ECHO  or
ECHO  Insert the SETUP Disk into the Floppy Drive
ECHO  and then...
PAUSE
GOTO DISK1

:ERR2
ECHO 
ECHO ÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ
ECHO  DISK ERROR - Wrong Disk inserted in Drive
ECHO ÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ
ECHO 
ECHO  Either press CTRL-C to abort the Installation,
ECHO  or
ECHO  Insert the PROGRAM Disk into the Floppy Drive
ECHO  and then...
PAUSE
GOTO DISK2

:OK
:DISK1
CHK_VL SETUP > NUL:
IF ERRORLEVEL 1 GOTO ERR1
ECHO 
ECHO ÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ
ECHO  Installing Program to %1
ECHO ÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ
ECHO 
ECHO  Copying the Setup Files . . .
ECHO 
COPY INSTALL.BAT %1 > NUL
COPY SETUP.* %1 > NUL
ECHO 
ECHO  Please Insert the Program Disk into the Floppy Drive
ECHO  and then...
PAUSE

:DISK2
CHK_VL PROGRAM > NUL:
IF ERRORLEVEL 1 GOTO ERR2
ECHO 
ECHO  Copying the Program . . .
ECHO 
COPY PRG.EXE %1 > NUL
ECHO 
ECHO  Transfering control to %1
ECHO 
%1
:DONE
ECHO 
ECHO  Initializing the Setup Files
ECHO 
SETUP %1
CLS
pause
ECHO 
ECHO  Finished installing
ECHO 
DEL %1INSTALL.BAT > NUL
:END


III. Copyright Notice

CHK_VL is Copyright (c) 1989 by OE Consulting. All rights are
reserved. OE Consulting is a subsidiary of Ostroff Enterprises.

The CHK_VL program is being released into the Public Domain and
may be distributed freely under the terms outlined below.

1) You may NOT charge any fees whatsoever, except for a
reasonable amount to cover the cost of DUPLICATION ONLY.

2) You MUST supply this ENTIRE document file UNALTERED with every
copy. (It should have a file date of 4/24/89).

If you have any questions or comments about CHK_VL, please contact
the program's author:

Mark Ostroff, President
OE Consulting
516 Harry Truman Drive
Upper Marlboro, Md. 20772

(301) 336-9434