Microsoft® Windows® 2000 Scripting Guide
« Previous | Next »
In some instances, useful configuration information is stored as the names of a set of subkeys. In the following sample script, for instance, the subkey names represent the services on a computer. In a case such as this, simply listing the names of the subkeys provides useful information.
The EnumKey method enables you to return the subkeys of a registry key or subkey. Note that the EnumKey method returns only the immediate subkeys of a key or subkey; it does not return any subkeys that might be contained within those top-level subkeys. For example, suppose you run the EnumKey method against the Control subkey shown in Figure 16.7. In this case, EnumKey will return an array consisting of the subkeys AGP, Arbiters, and BackupRestore. However, that array will not include the subkeys of those subkeys (such as AllocationOrder and DllPaths).
Figure 16.7 Sample Registry Subkeys
Sample Registry Subkeys
To return the subkeys of Arbiters and BackupRestore, you need to use a recursive function. For more information about recursive functions, see "VBScript Primer" in this book.
Listing 16.12 contains a script that enumerates the subkeys of a registry subkey. To carry out this task, the script must perform the following steps:
Listing 16.12 Enumerating Subkeys of a Subkey
|
|
Send us your feedback | « Previous | Next » |