Freigeben über


Introducing Arrays

Microsoft® Windows® 2000 Scripting Guide

Scripts are probably most useful when you need to carry out the same task multiple times. For example, if you own one computer, it is just as quick and just as easy to open the Services snap-in to see which services are installed as it would be to write a script to retrieve the same information. If you have 100 computers, however, you will likely prefer using a script to retrieve service information as opposed to manually retrieving this information.

Of course, if a script is to run against 100 different computers, it needs a way to store those computer names and a way to keep track of which computers it has retrieved service information from and which computers it has not. One common way to store related bits of information (such as a list of computer names) is in an array, a special type of variable that can be used to store (and later retrieve) multiple values.

Note

  • A full discussion of arrays, including the use of multidimensional arrays, is beyond the scope of this chapter. This chapter focuses on those aspects of arrays most commonly used in system administration scripts.