cfregistry

Description

This tag is deprecated for the UNIX platform.

Reads, writes, and deletes keys and values in the system registry. Provides persistent storage of client variables.

Note: For this tag to execute, it must be enabled in the ColdFusion Administrator. For more information, see Configuring and Administering ColdFusion.

Syntax

The tag syntax depends on the action attribute value. See the following sections:

History

ColdFusion MX:

  • Deprecated this tag on the UNIX platform. It might not work, and might cause an error, in later releases.

  • Changed how persistent data is stored: ColdFusion now stores most persistent data outside the system registry, in XML files.

cfregistry action = "getAll"

Description

Returns all registry keys and values defined in a branch. You can access the values as you would any record set.

Syntax

<cfregistry  
    action = "getAll" 
    branch = "branch" 
    name = "query name"  
    sort = "asc|desc" 
    type = "string|dWord|key|any">
Note: You can specify this tag’s attributes in an attributeCollection attribute whose value is a structure. Specify the structure name in the attributeCollection attribute and use the tag’s attribute names as structure keys.

See also

Using Persistent Data and Locking in the Developing ColdFusion Applications

Attributes

Attribute

Req/Opt

Default

Description

action

Required

 

Always getall.

branch

Required

 

Name of a registry branch.

name

Required

 

Name of record set to contain returned keys and values.

sort

Optional

asc

Sorts query column data (case-insensitive). Sorts on Entry, Type, and Value columns as text. Specify a combination of columns from query output, in a comma-delimited list. For example:

sort = "value desc, entry asc"
  • asc: ascending (a to z) sort order.

  • desc: descending (z to a) sort order.

type

Optional

string

  • string: returns string values.

  • dWord: returns DWord values.

  • key: returns keys.

  • any: returns keys and values.

Usage

This tag returns #entry#, #type#, and #value# in a record set that you can access through tags such as cfoutput. To fully qualify these variables, use the record set name, as specified in the name attribute.

If #type# is a key, #value# is an empty string.

If you specify type= "any", getAll also returns binary registry values. For binary values, the #type# variable contains UNSUPPORTED and #value# is blank.

Example

<!--- This example uses cfregistry with the getAll action. ---> 
<cfregistry action = "getAll" 
    branch = "HKEY_LOCAL_MACHINE\Software\Microsoft\Java VM"  
    type = "Any" name = "RegQuery"> 
<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>

cfregistry action = "get"

Description

Accesses a registry value and stores it in a ColdFusion variable.

Syntax

<cfregistry  
    action = "get" 
    branch = "branch" 
    entry = "key or value" 
    variable = "variable" 
    type = "string|dWord|key">
Note: You can specify this tag’s attributes in an attributeCollection attribute whose value is a structure. Specify the structure name in the attributeCollection attribute and use the tag’s attribute names as structure keys.

See also

Using Persistent Data and Locking in the Developing ColdFusion Applications

Attributes

Attribute

Req/Opt

Default

Description

action

Required

 

Always get.

branch

Required

 

Name of a registry branch.

entry

Required

 

Registry value to access.

variable

Required

 

Variable into which to put value.

type

Optional

string

  • string: returns string value.

  • dWord: returns DWord value.

  • key: returns key’s default value.

Usage

If the value does not exist, the cfregistry tag does not create an entry.

Example

<!--- This example uses cfregistry with the get action. ---> 
<cfregistry action = "get" 
    branch = "HKEY_LOCAL_MACHINE\Software\Microsoft\Java VM"  
    entry = "ClassPath" type = "String" variable = "RegValue"> 
<h1>cfregistry action = "get"</h1> 
<cfoutput> 
    Java ClassPath value is #RegValue# 
</cfoutput>

cfregistry action = "set"

Description

Adds a registry key, adds a value, or updates a value.

Syntax

<cfregistry  
    action = "set" 
    branch = "branch" 
    entry = "key or value" 
    type = "string|dWord|key" 
    value = "data">
Note: You can specify this tag’s attributes in an attributeCollection attribute whose value is a structure. Specify the structure name in the attributeCollection attribute and use the tag’s attribute names as structure keys.

See also

Using Persistent Data and Locking in the Developing ColdFusion Applications

Attributes

Attribute

Req/Opt

Default

Description

action

Required

 

Always set.

branch

Required

 

Name of a registry branch.

entry

Required

 

Key or value to set.

type

Optional

 

  • string: sets a string value (default).

  • dWord: sets a DWord value.

  • key: creates a key.

value

Optional

 

Value data to set. If you omit this attribute, the cfregistry tag creates default value, as follows:

  • string: creates an empty string: "".

  • dWord: creates a value of 0 (zero).

Usage

If it does not exist, the cfregistry tag creates the key or value.

Example

<!--- This example uses the cfregistry set action to modify registry value data. ---> 
<!--- Normally you pass in a filename instead of setting one here. ---> 
<cfset FileName = "dummy.cfm"> 
<cfregistry action = "set" 
    branch = "HKEY_LOCAL_MACHINE\Software\cflangref" 
    entry = "LastCFM01" type = "String" value = "#FileName#"> 
<h1>cfregistry action = "set"</h1>

cfregistry action = "delete"

Description

Deletes a registry key or value.

Syntax

<cfregistry  
    action = "delete" 
    branch = "branch" 
    entry = "key or value">
Note: You can specify this tag's attributes in an attributeCollection attribute whose value is a structure. Specify the structure name in the attributeCollection attribute and use the tag’s attribute names as structure keys.

See also

Using Persistent Data and Locking in the Developing ColdFusion Applications

Attributes

Attribute

Req/Opt

Default

Description

action

Required

 

Always delete.

branch

Required

 

  • For key deletion: name of registry key to delete. Do not specify the entry attribute.

  • For value deletion: name of registry branch that contains value to delete. Specify the entry attribute.

entry

Required for value deletion

 

Value to delete.

Usage

If you delete a key, the cfregistry tag also deletes values and subkeys defined beneath it.

Example

<cfregistry action = "delete" 
    branch = "HKEY_LOCAL_MACHINE\Software\cflangref\tempkey" 
    entry = "LastCFM01"> 
<h1>cfregistry action = "delete"</h1>