GetProfileString

Description

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 must 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.

Category

System functions

Syntax


GetProfileString(iniPath, section, entry) 

See also

SetProfileString

Parameters

Parameter
Description
iniPath
Fully qualified path (drive, directory, filename, and extension) of the initialization file; for example, C:\boot.ini
section
Section of the initialization file from which you to extract information
entry
Name of the value 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 checks whether the form was submitted. 

If it was, 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 no entry in an initialization file, nothing displays --->

  

  <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> 



Banner.Novgorod.Ru