The script displays an error message in this case and exits again. Because this is
another kind of error, the script sets the error level to 3. Notice that the script conveniently disregards
any more than two inputs.
At this point, all the code needs to handle is the case where the user doesn??™t provide any input
arguments. This is where the interactive features of scripting pay off. The script begins by asking
the user whether they want to provide the input interactively. If so, the code asks some simple questions
and tries to map the drive. If not, the code exits with a help message and an error level of 2.
The reason the script uses an error level of 2 is that this is the same kind of error as providing a
single input that isn??™t the /? command line switch.
Creating a CSV File
Sometimes it??™s important to see the same example using two different techniques. The example in
this section performs the same task as the batch file example in the ???Using a Centralized Data Store???
section of Chapter 5. When you compare the code in Listing 6.4 with the code in 5.7, you??™ll notice
that Listing 6.4 is significantly longer, even though it produces the same output.
Pages:
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479