Chapter 21. Working with the System Registry

Anyone running ColdFusion on the Windows platform has probably encountered the system registry at one point or another. The registry is a database of sorts that contains configuration information on virtually every user, and piece of hardware and software (including ColdFusion) on your system. The registry is organized in a hierarchical fashion like that of a tree. ColdFusion provides you with a tag for working with the system registry, the CFREGISTRY tag, which is capable of querying information from the registry, as well as setting new values and deleting unwanted ones.

Before we get into the specifics of manipulating registry data, let’s look at how the registry is organized. There are two basic units that make up the registry, keys and values. A key is a logical container similar to a filesystem’s directory. Like a directory that contains files and additional subdirectories, keys can contain values and/or subkeys. A registry key and the subkeys and values below it are referred to as a branch. If we were to write out the structure of a typical registry branch, it might look something like this:

HKEY_LOCAL_MACHINE\Software\Allaire\ColdFusion\CurrentVersion\Mail

This branch stores values used by ColdFusion to interface with mail servers. As you can see, the key/subkey relationship looks exactly like a directory structure might (in DOS anyway).

Values (like files) are actually a representation for name/value pairs. Values are also known ...

Get Programming ColdFusion now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.