Deleting Registry Keys and Values
There are times when you might
find it desirable to delete information from the system registry, for
example, if you want to delete a data source without having to go
through the ColdFusion Administrator. The
cfregistry
tag can delete a registry value, a
single registry key or an entire registry branch by setting the
action
attribute to Delete
. But
it is extremely important to know what you are doing with regards to
the registry before you use this action. You should also have a
current backup of your registry before using the
cfregistry
tag to delete registry entries. Example 25-7 deletes an entry from the registry.
Example 25-7. Deleting a registry value
<cfregistry action="Delete" branch="HKEY_LOCAL_MACHINE\Software\ODBC\ODBC.INI\MyDataSource" entry="Description"> <cfregistry action="GetAll" branch="HKEY_LOCAL_MACHINE\Software\ODBC\ODBC.INI\MyDataSource" name="GetAll" type="Any" sort="Asc"> <h3>HKEY_LOCAL_MACHINE\Software\ODBC\ODBC.INI\MyDataSource</h3> <table border="1"> <tr> <th>Entry</th><th>Type</th><th>Value</th> </tr> <cfoutput query="GetAll"> <tr> <td>#Entry#</td><td>#Type#</td><td>#Value#</td> </tr> </cfoutput> </table>
In Example 25-7, we set the action
attribute of the cfregistry
tag to
Delete
. branch
specifies the
branch containing the entry we want to delete. The
entry
attribute specifies the name of the entry we
want to delete, in this case, an entry named
Description
. Note that if the entry specified in
Entry
doesn’t exist, ColdFusion ...
Get Programming ColdFusion MX, 2nd Edition 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.