SetProifleString  
Description
Sets the value of a profile entry in an initialization file.
 
Returns
An empty string, upon successful execution; otherwise, an error message.
 
Category
System functions
 
Function syntax
SetProfileString(iniPath, section, entry, value)
 
See also
GetProfileSections, GetProfileString, SetProfileString
 
Example
<h3>SetProfileString Example</h3>
This example uses SetProfileString to set the timeout value in an
initialization file. Enter the full path of your initialization
file, specify the timeout value, and submit the form.
<!--- This section checks whether the form was submitted. If so, this
section sets the initialization path and timeout value to the
path and timeout value specified in the form --->
<cfif Isdefined("Form.Submit")>

   <cfset IniPath = FORM.iniPath>
   <cfset Section = "boot loader">
   <cfset MyTimeout = FORM.MyTimeout>
   <cfset timeout = GetProfileString(IniPath, Section, "timeout")>

   <cfif timeout Is Not MyTimeout>
    <cfif MyTimeout Greater Than 0>
       <hr size = "2" color = "#0000A0">
      <p>Setting the timeout value to <cfoutput>#MyTimeout#</cfoutput>
      </p>
         <cfset code = SetProfileString(IniPath,
            Section, "timeout", MyTimeout)>
      <p>Value returned from SetProfileString:
            <cfoutput>#code#</cfoutput></p>
      <cfelse>
         <hr size = "2" color = "red">
         <p>Timeout value should be greater than zero in order to
            provide time for user response.</p>
         <hr size = "2" color = "red">
      </cfif>
   <cfelse>
      <p>The timeout value in your initialization file is already
         <cfoutput>#MyTimeout#</cfoutput>.</p>
   </cfif>
   <cfset timeout = GetProfileString(IniPath, Section, "timeout")>
   <cfset default = GetProfileString(IniPath, Section, "default")>

   <h4>Boot Loader</h4>
   <p>Timeout is set to: <cfoutput>#timeout#</cfoutput>.</p>
   <p>Default directory is: <cfoutput>#default#</cfoutput>.</p>

</cfif>

<form action = "setprofilestring.cfm">
<hr size = "2" color = "#0000A0">
<table cellspacing = "2" cellpadding = "2" border = "0">
<tr>
  <td>Full Path of Init File</td>
  <td><input type = "Text" name = "IniPath"
            value = "C:\myboot.ini"></td>
</tr>
<tr>
  <td>Timeout</td>
  <td><input type = "Text" name = "MyTimeout" value = "30"></td>
</tr>
<tr>
  <td><input type = "Submit" name = "Submit" value = "Submit"></td>
  <td></td>
</tr>
</table>
</form>
iniPath  
Absolute path of initialization file
section  
Section of the initialization file in which the entry is to be set
entry  
Name of the entry to set
value  
Value to which to set the entry