Choosing a Technique

Table 9-1 lays out the substantial differences—as I see them—between the scripting methods covered in this chapter. Each column represents one of the five scripting methods that I describe in this chapter. For example, the Batch column describes using Reg.exe in a batch file. The MSI column describes Windows Installer package files that include registry settings. First the similarities: All five methods enable you to change values as well as add keys or values. Also, Windows XP supports all five methods without installing third-party tools or any resource kits.

Table 9-1: Comparison of Scripting Methods

Features

INF

REG

Batch

Script

MSI

Difficulty

Medium

Low

Medium

High

Medium

OS access

Basic

None

Full

Full

Basic

Built-in support

Yes

Yes

Yes

Yes

Yes

Change values

Yes

Yes

Yes

Yes

Yes

Add keys/values

Yes

Yes

Yes

Yes

Yes

Delete keys/values

Yes

Keys only

Yes

Yes

Yes

Querying values

No

No

Yes

Yes

No

Support for value types

High

Medium

Medium

Low

Medium

Bitwise support

Yes

No

No

Yes

No

Nine times out of ten, my preference is to write an INF file. You'll notice that most of the scripts in this book are INF files. I chose this method because I'm familiar with INF files, they're easy to create, and they're easy to read. I use scripts only when I have to query values from the registry. INF files' strong suit is that they offer the flexibility to do anything I want in the registry without requiring me to put on a programmer hat for the weekend. Choose whatever methods best suit you, but give more weight to INF files and scripts. You won't end up using just one of these techniques, though. In fact, you'll find that you'll use a combination of these methods, depending on the scenario. After you start using the script methods I describe in this chapter, you'll master them in no time.

Now I'll describe the differences. As the table shows, using REG files is the easiest method, scripts and Windows Installer package files are the most difficult, and the rest fall somewhere in between. No matter which method you choose, they all become rather easy after you learn how to use them. Access to the operating system is important only if you're trying to do more than just edit the registry. For example, if you want to read values from the registry and then dump them to a text file, you're going to need access to the operating system. The most important difference is that only INF files and scripts provide high support for the many different types of values you can store in the registry. The remaining methods support the basic value types, though, and that's often all you need. If you need to edit more esoteric types, though, you're better off writing an INF file or a script. Likewise, INF files and scripts are the only two methods you can use to set and clear bits in values. For example, the bits in the value UserPreferencesMask indicate different user interface settings, and you enable or disable them by setting or clearing the corresponding bit. If this is your requirement, you're left with INF files or scripts as your method of choice.



Microsoft Windows XP Registry Guide
Microsoft Windows XP Registry Guide (Bpg-Other)
ISBN: 0735617880
EAN: 2147483647
Year: 2005
Pages: 185

flylib.com © 2008-2017.
If you may any questions please contact us: flylib@qtcs.net