BackUp LevelNext

Getting Registry Values

You can use CFREGISTRY with either the GET or GETALL actions to retrieve multiple keys and values from the registry.

Getting all keys and values

Use CFREGISTRY with the GETALL action to return all registry keys and values defined in a branch. You can access these values as follows:

To get all values for a specified registry key:

  1. Code a CFREGISTRY tag with the GETALL action, specifying the branch, type, and record set name.
    <CFREGISTRY ACTION="GetAll"
        BRANCH="HKEY_LOCAL_MACHINE\Software\Microsoft\Java VM"
        TYPE="Any" NAME="RegQuery">
    
  2. Access the record set (this example uses the CFTABLE tag):
    <H1>CFREGISTRY ACTION="GetAll"</H1>
    <CFTABLE QUERY="RegQuery" COLHEADERS 
        HTMLTABLE BORDER="Yes">
    <CFCOL HEADER="<B>Entry</b>" WIDTH="35" 
        TEXT="#RegQuery.Entry#">
    <CFCOL HEADER="<B>Type</b>" WIDTH="10" 
        TEXT="#RegQuery.Type#">
    <CFCOL HEADER="<B>Value</b>" WIDTH="35" 
        TEXT="#RegQuery.Value#">
    </CFTABLE>
    

Getting a specific value

Use CFREGISTRY with the GET action to access a single registry value and store it in a ColdFusion variable.

To get a specific registry value:

  1. Code a CFREGISTRY tag with the GET action, specifying the branch, the entry to be accessed, the type (optional), and a variable in which to return the value.
    <CFREGISTRY ACTION="Get"
        BRANCH="HKEY_LOCAL_MACHINE\Software\Microsoft\Java VM"
        ENTRY="ClassPath" TYPE="String" Variable="RegValue">
    
  2. Access the variable:
    <H1>CFREGISTRY ACTION="Get"</H1>
    <CFOUTPUT>
    <P>
    Java ClassPath value is #RegValue#
    </CFOUTPUT>
    

BackUp LevelNext

allaire

AllaireDoc@allaire.com
Copyright © 1998, Allaire Corporation. All rights reserved.