Prev | Current Page 375 | Next

John Paul Mueller

"Administering Windows Server 2008 Server Core"

In some cases, you??™ll look for a specific file or act on
user input to the batch file. You can also verify that the user provided a certain input string. The
point is that you can exercise some control over how the batch files react to system and environmental
conditions. Batch files don??™t provide extensive decision-making support, but you can use
these three forms of the If statement to increase the flexibility of your batch files.
If [Not] ErrorLevel number command
If [Not] string1==string2 command
If [Not] Exist filename command
CREATING BATCH FILES 143
In all three cases, you can add the word ???Not??? to perform the reverse of the check. For example,
you can perform a task when a given file doesn??™t exist, rather than when it does exist. By combining
both versions of the If statement, you can create the equivalent of an If...Else statement found
in most programming languages.
The ErrorLevel argument requires special consideration. Whenever you run an application,
batch file, or script, the system provides a numeric error level as output. By convention, an error
level of 0 always represents success. Other numbers represent an error or special condition.


Pages:
363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387
usługi remontowe wycieczki do Skandynawii traktorki ogrodowe skarpetki narciarskie męskie perfumy fm