Summary

In this chapter, you added decision making to your tool set by using two basic constructions: If...Then and Select Case. You also looked at two variations on the basic theme of If...Then: If...Then...Else and If...Then...ElseIf. The If...Then...ElseIf construction allows the evaluation of three or more situations but can get cumbersome and hard to read. For situations that require the evaluation of more than four parameters, it is almost always easier to use Select Case. Because we were looking at If...Then and Select Case, I also threw in the concept of intrinsic constants such as vbCrLf, which can be used to format output by starting a new line. You also looked at using variables to streamline WMI queries and connection strings.

Get Microsoft® Windows® Scripting Self-Paced Learning Guide now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.