# IniRead

Reads a value from a standard format .ini file.

IniRead, OutputVar, Filename, Section, Key [, Default]

#### Parameters

OutputVar | The name of the variable in which to store the retrieved value. If the value cannot be retrieved, the variable is set to the value indicated by the Default parameter (described below).
Filename | The name of the .ini file, which is assumed to be in %A_WorkingDir% if an absolute path isn't specified.
Section | The section name in the .ini file, which is the heading phrase that appears in square brackets (do not include the brackets in this parameter).
Key | The key name in the .ini file.
Default | The value to store in OutputVar if the requested key is not found. If omitted, it defaults to the word ERROR. To store a blank value (empty string), specify %A_Space%. For AutoIt (.aut) scripts: For compatibility reasons, this parameter is not supported; the string ERROR will always be stored in OutputVar if there was a problem reading the value.

#### ErrorLevel

ErrorLevel is not set by this command. If there was a problem, OutputVar will be set to the Default value as described above.

#### Remarks

The operating system automatically omits leading and trailing spaces/tabs from the retrieved string.

A standard ini file looks like:

[SectionName]
Key=Value

#### Related

IniDelete, IniWrite, RegRead, file-reading loop, FileRead

#### Example

    IniRead, OutputVar, C:\Temp\myfile.ini, section2, key
    MsgBox, The value is %OutputVar%.