How can I parse variable from another ini file?
In following example, I'd like to parse var_a
from original_configuration.ini
and use it at new_configuration.ini
original_configuration.ini:
[Section A]
var_a = "foo"
var_b = "bar"
new_configuration.ini:
[Section B]
var_c = "lorem"
var_d = {value of var_a in original_configuration.ini}
A variety of environment variables and CCI. INI file entries can be used to customize CCI behavior either on a machine-wide or per-process basis. Most users should not need to use either of these methods, but they are provided in case a greater degree of application control is required.
Comments in the INI must start with a semicolon (";") or a hash character ("#"), and run to the end of the line. A comment can be a line of its own, or it may follow a key/value pair (the "#" character and trailing comments are extensions of minIni).
ini parameters are now case-insensitive. Their assigned values, however, can be case-sensitive, depending on the platform.
Starting with Windows 95, operating system settings were moved to the Registry, and software vendors were encouaged to move their settings to the Registry as well. However, all subsequent versions of Windows continued support for the creation and use of INI files, and they are still widely used by applications.
Since an INI file is an informal standard it depends on the program which is using the configuration file:
The INI file format is an informal standard for configuration files for some platforms or software. INI files are simple text files with a basic structure composed of sections, properties, and values.
Neither Wikipedia nor Microsoft's page about INI configutariont files mention anything about referring to other properties or other configuration files. However since it is not a formal standard, each configuration parser can have its own variant. This answer for example, shows that Python's configparser
package is able to refer to other properties:
[env]
name = DEV
[dir]
home = /home/${env:name}/scripts
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With