Windows Configuration Settings File Format
- Updated2025-08-15
- 4 minute(s) read
Windows configuration settings files are text files divided into named sections. Brackets enclose each section name. Every section name in a file must be unique. The sections contain key/value pairs separated by an equal sign (=). Within each section, every key name must be unique. The key name represents a configuration preference, and the value name represents the setting for that preference. The following example shows the arrangement of the file:
[Section 1]
key1=value
key2=value
[Section 2]
key1=value
key2=value
Use the following data types with Configuration File VIs for the value portion of the key parameter:
- String
- Path
- Boolean
- 64-bit double-precision floating-point numeric
- 32-bit signed integer
- 32-bit unsigned integer
To use the Configuration File VIs, you must format each line of text in an .ini file correctly. A line must either be empty or contain a section name, a key-value pair, or a comment.
|
Note You can use the Configuration File VIs for Windows configuration settings files only in the ANSI format. |
Use the following guidelines to format lines with section names:
- Include at least one character
- Do not use a closed bracket as part of the name
- Do not include unprintable characters
- Use an open bracket for the first non-white space character
- Use a closed bracket at the end of the line of text
- Keep all the characters on one line
Use the following guidelines to format lines with key-value pairs:
- Include pairs on the lines after the section line
- Include an equal sign after the key name
- Keep all the characters on one line
- Use valid key names
- Include at least one character
- Do not start with a semicolon
- Do not include an equal sign
- Do not start with an open bracket
- Do not start with a white space character
- Do not end with a white space character
- Do not include unprintable characters
- Use valid value names
- Keep the data type consistent
- Do not start with a white space character
- Do not end with a white space character
|
Note If values begin or end with white space characters, you must put the values in quotation marks. LabVIEW removes the quotation marks when a VI returns the value. |
Configuration File VIs ignore lines without section names or value-key pairs during a read operation, and they preserve lines without section names or value-key pairs during a write operation.
When VIs write to a configuration file, they place quotation marks around any string or path data. LabVIEW also supports single quotes around values in .ini files.
The accepted comment notation for configuration files is a semicolon, which can indicate that the text following the semicolon is a comment. A semicolon at the beginning of a line indicates a comment. A semicolon in a section name, numeric value, or Boolean value also indicates a comment. However, a semicolon in a string value name does not indicate a comment.
If you include a semicolon as the first character of a key name, LabVIEW does not return a key name or value because the configuration files do not support a semicolon as the first character of a key name. If you include a semicolon at any other place in the key name besides as the first character, LabVIEW returns the key name with the semicolon.
The following table provides examples of how the Configuration File VIs read section names in .ini files.
| Example text in.ini file | Section name |
|---|---|
| [sec1] | sec1 |
| [[sec2]] | [sec2 |
| [sec with spaces] | sec with spaces |
| [seccom] ;comments | seccom |
| [sectext] sometext | sectext |
The following table provides examples of how the Configuration File VIs read key-value pairs in .ini files.
| Example text in.ini file | Key name | Value |
|---|---|---|
| keyname='mystring' | keyname | mystring |
| ;keyname="mystring" | — | — |
| keyname="my;string" | keyname | my;string |
| keyname = 12.3 ;comm | keyname | 12.3 |
| key;name="mystring" | key;name | mystring |
| key\;name="my;string";more | key\;name | "my;string";more |
| key name6=" mystring6" | key name6 | mystring6 |
| keyname8 = mystring8 | keyname8 | mystring8 |
| keyname9 = " mystring9 " | keyname9 | mystring9 |
| keyname12==mystring12 | keyname12 | =mystring12 |
| #keyname13 = mystring13 | #keyname13 | mystring13 |
| abc= | abc | — |
| abc | — | — |
|
Note Because the Read Key VI is a polymorphic VI, it acts differently in certain instances. For example, for the keyname = 12.3 ;comm key-value pair, the String instance returns a string value of 12.3;comm and the Double instance returns a numeric of 12.3 for the value output. |
The Configuration File VIs can read and write raw or escaped string data. The VIs read and write raw data byte-for-byte, without converting the data to ASCII. In converted, or escaped, strings LabVIEW stores any non-displayable text characters in the configuration settings file with the equivalent hexadecimal escape codes, such as \0D for a carriage return. In addition, LabVIEW stores backslash characters in the configuration settings file as double backslashes, such as \\ for \. Set the read raw string? or write raw string? inputs of the Configuration File VIs to TRUE for raw data and to FALSE for escaped data.
In configuration settings files, LabVIEW stores path data in the standard Linux format for paths. The VIs interpret the absolute path /c/temp/data.dat stored in a configuration settings file as follows:
- (Windows) c:\temp\data.dat
- (macOS 32-bit) c:temp:data.dat
- (macOS 64-bit and Linux) /c/temp/data.dat
The VIs interpret the relative path temp/data.dat as follows:
- (Windows) temp\data.dat
- (macOS 32-bit) :temp:data.dat
- (macOS 64-bit and Linux) temp/data.dat