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

Output of file : ADVBAT03.TXT contained in archive : ABFS.ZIP
Demonstration 1 -- "Restartable" Batch Files

o Have you ever written rather long .BAT file, and had it "crash" at
some point due to a missing file, write protected file etc., only
to curse fluently because you could not "restart" it other than at
the top without either creating a new batch file by editing the
old one or simply editing the old one and destroying it in the process?

o Here's how to use the ENVIRONMENT and the %0 BATCH Parameter to handle
the situation:

1. Wherever you MIGHT want to restart, insert a LABEL like


2. Follow this with:


3. At the TOP of the BATCH file, code the following:


Ok, here is what happens -- (provided your ENVIRONMENT is big enough to
hold the RESTART=3 variable of course ... {use SHELL= ... /E:nnn}).

1. The BAT file starts execution, and as it passes each restart point,
it (re)sets the "global variable" to 1, 2, 3 ... etc.

2. Presume a failure or {CTRL-BREAK} occurs in PHASE "2" and we want to
restart. We type the basic .BAT file name like DO_DEMO1 and any
parameters it needs, which then restarts the .BAT file at the top.

3. Now, however, the environment variable RESTART is Non-Null, and
the IF statement then branches us right to ":PHASE2"!

o Lets see what happens with this technique by running Do_DEMO1.BAT, and
then pressing {CTRL-BREAK} at the PAUSE in the file located in PHASE2.

  3 Responses to “Category : Batch File Utilities - mostly for DOS
Archive   : ABFS.ZIP
Filename : ADVBAT03.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: