Microsoft® Windows® 2000 Scripting Guide
« Previous | Next »
Before you can manage disk drives on a computer, you need to know which disk drives are actually available on that computer. The FileSystemObject allows you to return a collection of all the drives installed on a computer, including removable drives and mapped network drives (in other words, any drive with a drive letter).
To return this collection, create an instance of the FileSystemObject, and then create a reference to the Drives property. After the collection has been returned, you can use a For Each loop to iterate through the collection.
For example, the script in Listing 4.1 returns a collection of all the drives installed on a computer and then echoes the drive letter for each drive in the collection.
Listing 4.1 Enumerating All the Drives on a Computer
|
|
For a complete list of drive properties available using the FileSystemObject, see Table 4.2 later in this chapter.
Send us your feedback | « Previous | Next » |