• Create BookmarkCreate Bookmark
  • Create Note or TagCreate Note or Tag
  • PrintPrint
Share this Page URL
Help

Chapter 21. Working with the System Registry > Setting Registry Keys and Values

21.2. Setting Registry Keys and Values

Besides retrieving registry keys and values, the CFREGISTRY tag can also create new registry keys as well as set and update registry values. This allows you, for example, to store application-specific information in the system registry as opposed to in a database. It also allows you to add/update ODBC data sources and Verity collections that normally must be added/updated through the ColdFusion Administrator. As a matter of fact, this is exactly how the ColdFusion Administrator handles these tasks behind the scenes. Example 21-4 shows how to add a key called Test to the registry.

Example 21-4. Creating a Registry Key

<!--- this creates a new key called Test under CurrentVersion --->
<CFREGISTRY ACTION="Set"
          BRANCH="HKEY_LOCAL_MACHINE\Software\Allaire\ColdFusion\CurrentVersion"
          TYPE="Key" ENTRY="Test">

<!--- Query the CurrentVersion key so that we can show it was added --->            
<CFREGISTRY ACTION="GETALL"
          BRANCH="HKEY_LOCAL_MACHINE\Software\Allaire\ColdFusion\CurrentVersion"
          NAME="GetCurrent" TYPE="Any" SORT="ASC">

<H3>HKEY_LOCAL_MACHINE\Software\Allaire\ColdFusion\CurrentVersion</H3>

<TABLE BORDER="1">
<TR>
  <TH>Entry</TH><TH>Type</TH><TH>Value</TH>
</TR>

<CFOUTPUT QUERY="GetCurrent">
<TR>
  <TD>#Entry#</TD><TD>#Type#</TD><TD>#Value#</TD>
</TR>
</CFOUTPUT>
</TABLE>

					  


PREVIEW

                                                                          

Not a subscriber?

Start A Free Trial


  
  • Creative Edge
  • Create BookmarkCreate Bookmark
  • Create Note or TagCreate Note or Tag
  • PrintPrint