getProfileString

Description

Gets an initialization file entry.

Categories

Related

Syntax

GetProfileString(iniPath, section, entry)

Attributes

AttributeDescriptionRequiredDefault
entryName of value to get
iniPathAbsolute path (drive, directory, filename, extension) of initialization file; for example, C:\boot.ini
sectionSection of initialization file from which to extract information

Returns

An entry in an initialization file, as a string. If there is no value, returns an empty string.

Example

<h3>GetProfileString Example</h3> 
Uses GetProfileString to get the value of timeout in an initialization file. Enter 
    the full path of your initialization file, and submit the form. 
<!--- If the form was submitted, it gets the initialization path and timeout value specified in the form ---> 
<cfif Isdefined("Form.Submit")> 
    <cfset IniPath = FORM.iniPath> 
    <cfset Section = "boot loader"> 
    <cfset timeout = GetProfileString(IniPath, Section, "timeout")> 
    <h4>Boot Loader</h4> 
    <!--- If no entry in an initialization file, nothing displays ---> 
    Timeout is set to: <cfoutput>#timeout#</cfoutput>.</p> 
</cfif> 
<form action = "getprofilestring.cfm"> 
<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><input type = "Submit" name = "Submit" value = "Submit"></td> 
     <td></td> 
    </tr></table> 
</form>