SHORTIES\CAPARAMS.DOC  ·  DOC  ·  1.4 KB  ·  1991-01-01  ·  from PCPlus_Issue-52_Jan-1991_FluxEngine-360Kb
CAPARAMS  by Clockwork Software

This little program capitalises all the parameters of the currently running
batch file (.BAT).  It has no effect if it is run from the DOS prompt.

Everything in the command line which executes a batch file can be referred
to within the .BAT itself using replaceable parameters %0 to %9; further,
the SHIFT command can bring even more operands into reach.  The contents of
parameters can be tested with the IF instruction.  All this can be found in
your DOS manual.

The trouble is, though, that the IF comparison is case-sensitive: for example,
        IF "%1"=="YES" GOTO CHOICE3
will only work as intended when parameter one is YES - it will not work if
yes, Yes, yEs, YEs or something similar was keyed.  A thorough, 'bulletproof'
batch file would have to test multiple conditions!

CAPARAMS simply finds the header block belonging to the currently executing
batch file and capitalises all the parameters.  A single test is then
sufficient.

examples:
        SWITCH On               (execute SWITCH.BAT)

  SWITCH.BAT
  ----------
        ECHO OFF
        CAPARAMS
        IF "%1"=="ON"  GOTO switchon
        IF "%1"=="OFF" GOTO switchoff
        :
        :


  TESTER.BAT
  ----------
        ECHO OFF
        ECHO this is tester.bat
        ECHO the parameters are %0 %1 %2 %3 %4 %5
        CAPARAMS
        ECHO parameters are now %0 %1 %2 %3 %4 %5