Knowing how to access the registry
from your script is important because you also need to access these values in order to discover
how a particular utility will react or how the user had configured the system. You can also use the
registry to store and retrieve values for your script. The example in Listing 6.2 shows how to use
VBScript to access information in the registry. You don??™t want to change information unless you
have to, but seeing what??™s available in the registry is a good way to build your knowledge of both
scripting and the registry. Note that this example uses the command line argument to determine
which file extension to look for in the registry. The example uses the TXT file extension when you
don??™t supply one. You can obtain this example on the Sybex Web site at http://www.sybex.com/
WileyCDA/.
CREATING A BASIC SCRIPT 175
Listing 6.2: Working with the Registry
` RegRead.VBE will display the application extension information
` contained in the registry.
` Create an icon and button variable for Popup().
intOK = 0
intInformation = 64
` Create a popup display object.
set WshShell = WScript.CreateObject(???WScript.
Pages:
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452