The GOTO :EOF
statement is special; it tells the batch file to end now. You don??™t have to define a label, in this case,
because EOF is built into the command process. (See the ???Using the Goto Command??? section of this
chapter for details.)
The Batch2.BAT file always echoes ???In Batch 2, Goodbye.??? In this case, the IF statements verify
that the caller has passed information to the batch file. When the caller doesn??™t pass the required
variables, then the batch file doesn??™t display any information for that input. The [%1]==[] construct
is one way to check for an empty input. Figure 5.3 shows the output from this application. Notice
the sequence of events. The first batch file calls the second batch file. When the second batch file is
finished, execution continues with the next statement in the first batch file.
136 CHAPTER 5 CREATING CMD AND BAT FILES
Figure 5.3
Calls provide a means
of performing subtasks
in a batch file
and then continuing
with the main task.
Windows provides enhanced methods of working with variables in batch files. These enhanced
expansions help you pass specific variable information to a callee from your batch files.
Pages:
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370