Prev | Current Page 357 | Next

John Paul Mueller

"Administering Windows Server 2008 Server Core"

You must provide an exit strategy, however, or the batch file will enter
an endless loop.
The easiest way to see the effect of the Call command is to create two batch files named
Batch1.BAT and Batch2.BAT. Here??™s the content for Batch1.BAT.
@ECHO OFF
Call Batch2.BAT
Call Batch2.BAT Passed %1 %PATH%
ECHO In Batch 1
GOTO :EOF
ECHO Goodbye
Here??™s the content for Batch2.BAT.
ECHO In Batch 2, Goodbye
IF NOT [%1]==[] ECHO String: %1
IF NOT [%2]==[] ECHO Batch 1 Input: %2
IF NOT [%3]==[] ECHO Environment Variable: %3
Looking at the Batch1.BAT content, the example begins by turning off echo. You??™ll normally add
this code to your batch files so the user doesn??™t see a lot of confusing text that has nothing to do with
the current task. Preceding the ECHO command with the @ symbol tells the system not to display the
ECHO command either. The first call to Batch2.BAT doesn??™t pass any information, so Batch2.BAT
only displays the message, ???In Batch 2, Goodbye.??? The second call to Batch2.BAT passes the three
kinds of information you can include with a batch file: a string, a local variable (argument), and a
global variable. The code then proceeds to display ???In Batch 1,??? and then it exits.


Pages:
345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369
Pozycjonowanie katalog warszawa Curriculum Vitae kratki ściekowe Odżywki