An initialization file, or INI file, is a configuration file that contains configuration data for Microsoft Windows based applications. Starting with Windows 95, the INI file format was superseded but not entirely replaced by a registry database in Microsoft operating systems.
Although made popular by Windows, INI files can be used on any system thanks to their flexibility. They allow a program to store configuration data, which can then be easily parsed and changed.
= File Format =
A typical INI file might look like this:
[section1]
; some comment on section1
var1 = foo
var2 = doodle
[section2]
; another comment
var1 = baz
var2 = shoodle
== Format ==
This describes the elements of the INI file format:
Sections: Sections start with [ and end with ] as in [section1] and [section2] above.
Parameters: The var1 = foo above is an example of a parameter (also known as a key). Parameters begin with a key ( var1 ), equals sign ( = ), and a value ( foo ).
Comments: All the lines starting with a ; are assumed to be Comments, and are ignored.
== Differences ==
The format of INI files is not well defined. Many programs interpret their structure differently than the basic structure that was defined in the above example. The following is a basic list of some of the differences:
Comments: Programs like Samba software accept either ; or # as comments. Comments can be added after parameters with several formats.
Backslashes: Adding a backslash allows you to continue the value from one line to another.
Duplicate parameters: Most of the time, you can t have two parameters with the same name in one section. Therefore we can say that parameters are local to the section. Although this behavior can vary between implementations, it is advisable to stick with this rule.
Duplicate sections: If you have more than one section with the same name then the last section overrides the previous one.
= External Links =
== Programming Libraries ==
The following is a listing of Code library for INI files:
[http://nini.sourceforge.net/ Nini]: Configuration library for the Microsoft .NET and Mono development platform.
[http://ndevilla.free.fr/iniparser/ iniParser]: stand-alone INI parser library in C programming language
[http://kingleo.home.pages.at/show=/development/cpp LeoINI]: C plus plus INI parser
[http://docs.python.org/lib/module-ConfigParser.html ConfigParser]: Python programming language s standard INI parsing module.
[http://sourceforge.net/projects/config-inifiles Config::IniFiles]: Perl INI parser
[http://tcllib.sourceforge.net/doc/ini.html inifile] : Tcl INI file library
[http://www.php.net/manual/en/function.parse-ini-file.php parse-ini-file] : PHP INI parser