ConfigFile Read
This command reads a value for an entry from the specified section in a configuration file.
Syntax
ConfigFile Read var, entry, section, file, [default], [max_size]
Synonyms
CN RD
Parameters
The following table describes the parameters of the ConfigFile Read command:
| Parameter | Description |
|---|---|
| var | Name of the variable to be updated with the value of the entry |
| entry | Entry name in the configuration file |
| section | Section name in the configuration file |
| file | Configuration file name |
| default | Text to return if entry is not found; "" if not specified |
| max_size | Maximum size of entry to return; default is 255 characters. If the size of the return value is greater than max_size, it is truncated. |
Examples
The following example is from the C:\wintuser.ini configuration file.
[User]
Surname=Robertshaw
First Name=David
Then the following example script reads the Surname and assigns it to the variable username.
* To get the surname (in this case Robertshaw) or Unknown if
* the entry does not exist
ConfigFile Read username, "Surname", "User", "c:\wintuser.ini", "Unknown"Related Script Commands
ConfigFile ReadInteger, ConfigFile ReadSection, ConfigFile Write