# Setting Registry Values

Use CFREGISTRY with the SET action to add a registry key, add a new value, or update value data. CFREGISTRY creates the key or value if it does not exist.

| To set a registry value:

Call the CFREGISTRY tag with the SET action, specifying the branch, the entry to set, the type of data contained in the value, and the value data. This example assumes a session variable named LastFileName:

    <CFREGISTRY ACTION="Set"
        BRANCH="HKEY_LOCAL_MACHINE\Software\cflangref"
        ENTRY="LastCFM01" TYPE="String"
        VALUE="#SESSION.LastFileName#">

If the specified value does not exist, ColdFusion creates it. If the value already exists, ColdFusion updates the value data.

| To create a registry key:

Call the CFREGISTRY tag with the SET action, specifying the branch, the entry to set, specifying KEY for the TYPE attribute:

    <CFREGISTRY ACTION="Set"
        BRANCH="HKEY_LOCAL_MACHINE\Software\cflangref"
        ENTRY="Temp" TYPE="Key">