Category : Batch File Utilities - mostly for DOS
Archive   : ABFS.ZIP
Filename : ADVBAT06.TXT

 
Output of file : ADVBAT06.TXT contained in archive : ABFS.ZIP
Now RESTARTing an interrupted batch file is all well and good, but just
how often do you need to write such long and complicated batch files?

Well, there is another use for this technique: SAVING SPACE ON .BAT FILES!

Every .BAT file you write will occupy 2,048, 4,096 or even more bytes on
your hard disk, even if the file is only 5 or ten bytes long. This is
because DOS allocates file space in chunks of "clusters", where clusters
are either 2, 4 ... etc. sectors (512 bytes each!) long.

AT A COST (Slightly Slower BATCH File Execution), we can combine many small
batch files into one larger one, and still get the individual components
to recognize their old parameters, honor SHIFT etc. We do this by using
the same "Restart" technique, but we are not "Restarting" at all ...

Presume we have two small batch files:

@Echo Off
REM FONT.BAT
REM
REM Simply copies a printer escape sequence, stored in %1.FNT, to
REM the printer, followed by a list of one or more files, each of
REM which is to be preceeded by that font string.
REM
IF .%1==. goto omega1
set fs=%1
shift
:TOP1
IF .%1==. goto omega1
Echo Printing %1 Using Font: %fs
COPY /b %fs.fnt+%1 LPT1: > nul:
shift
goto TOP1
:omega1



@Echo Off
REM ZV.BAT
REM
REM Simply invokes PKUNZIP to list ZIP archives to screenm using
REM a looping technique similar to FONT.BAT above.
:TOP2
if .%1==. goto OMEGA2
pkunzip -v %1 | more
Pause
goto top2
:OMEGA2

Now, (note the careful choice of label names above to avoid duplicate
labels ... messy, messy details eh what?), we can COMBINE these two
small .BATs into one larger one, as follows:

REM X.BAT
@Echo Off
if .%0==X goto omega
if .%0==X.FONT goto FONT
if .%0==X.ZV goto ZV
goto omega
:FONT
REM
REM Simply copies a printer escape sequence, stored in %1.FNT, to
REM the printer, followed by a list of one or more files, each of

REM which is to be preceeded by that font string.
REM
IF .%1==. goto omega1
set fs=%1
shift
:TOP1
IF .%1==. goto omega1
Echo Printing %1 Using Font: %fs
COPY /b %fs.fnt+%1 LPT1: > nul:
shift
goto TOP1
:omega1
goto omega
:ZV
REM
REM Simply invokes PKUNZIP to list ZIP archives to screenm using
REM a looping technique similar to FONT.BAT above.
:TOP2
if .%1==. goto OMEGA2
pkunzip -v %1 | more
Pause
goto top2
:OMEGA2
goto omega
:omega





  3 Responses to “Category : Batch File Utilities - mostly for DOS
Archive   : ABFS.ZIP
Filename : ADVBAT06.TXT

  1. Very nice! Thank you for this wonderful archive. I wonder why I found it only now. Long live the BBS file archives!

  2. This is so awesome! 😀 I’d be cool if you could download an entire archive of this at once, though.

  3. But one thing that puzzles me is the “mtswslnkmcjklsdlsbdmMICROSOFT” string. There is an article about it here. It is definitely worth a read: http://www.os2museum.com/wp/mtswslnk/