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:

  • CFREGISTRY creates a record set that contains #Entry#, #Type#, and #Value#. You can access through tags such as CFOUTPUT. To fully qualify these variables use the record set name, as specified in the NAME attribute of the CFREGISTRY tag.
  • If #Type# is a key, #Value# is an empty string.
  • If you specify Any for TYPE, GetAll also returns any binary registry values. For binary values, the #Type# variable contains UNSUPPORTED and #Value# is blank.

    You can optionally specify the SORT attribute to sort the record set based on the contents of the Entry, Type, and Value columns. Specify any combination of columns in a comma separated list. ASC (ascending) or DESC (descending) can be specified as qualifiers for column names. ASC is the default. For example:

    Sort="type ASC, entry ASC"

 
 
  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.