In addition, the
146 CHAPTER 5 CREATING CMD AND BAT FILES
entire statement must appear on a single line. You can??™t separate the various elements to provide
a neater appearance. Here??™s an example of this form of the If command.
IF [%1] EQU [] (ECHO String Empty) ELSE (ECHO String Has Data)
In this case, the If command checks whether the input has a string for the first variable. When the
input is available, the output tells the user that the string has data. Otherwise, the input displays,
???String Empty??? as output.
CMDEXTVERSION Number Tests for a specific version of the command extensions feature. When
the command extension version number is equal to or greater than the specified number, the
condition is true. This form of If command never returns true when you disable command
extensions.
DEFINED Variable Tests whether you have a specific environment variable defined. The DEFINED
argument works just like the EXISTS argument. The If command returns true when the variable
is defined.
Using the Pause Command
The Pause command stops batch file execution to give the user time to react to a particular need.
For example, if you need the user to change media to complete the batch file, you could use the Echo
command to tell the user about the need and then use the Pause command to tell the user to press
any key when the media exchange is complete.
Pages:
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394