GetProfileString

Returns the value of an entry in an initialization file or an empty string if the value does not exist. An initialization file assigns values to configuration variables, also known as entries, that need to be set when the system boots, the operating system comes up, or an application starts. An initialization file is distinguished from other files by its .ini suffix, for example, boot.ini, Win32.ini, and setup.ini.

See also SetProfileString.

Syntax

GetProfileString(iniPath, section, entry)
iniPath

Fully qualified path (drive, directory, filename, and extension) of the initialization file, for example, C:\boot.ini.

section

The section of the initialization file from which you would like to extract information.

entry

The name of the value that you would like to see.

Example

<!---This example uses GetProfileString to set the 
     timeout value in an initialization file. --->

<HTML>
<HEAD>
<TITLE>GetProfileString Example</TITLE>
</HEAD>

<body  bgcolor="#FFFFD5">

<H3>GetProfileString Example</H3>

This example uses GetProfileString to get the value of timeout in an 
initialization file. Enter the full path of your initialization file, and 
submit the form.

<!---  This section of code checks to see if the form was submitted.
       If the form was submitted, this section gets the initialization
       path and timeout value of the 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 you do not have an entry in an initialization file, nothing 
          will be displayed --->
    
    <P>Timeout is set to: <CFOUTPUT>#timeout#</CFOUTPUT>.</P>
            
</CFIF>

<FORM ACTION="getprofilestring.cfm" METHOD="POST">
<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><INPUT TYPE="Submit" NAME="Submit" VALUE="Submit"></td>
    <td></td>
</tr>
</table>

</FORM>
<hr size="2" color="#0000A0">

</BODY>
</HTML> 


1