Initialization file

from Wikipedia, the free encyclopedia

An initialization file ( INI file for short ) is a text file that contains key-value pairs that may be broken down into sections. Initialization files are typically used by Microsoft Windows - applications as a configuration file used. Until the introduction of the registry database with Microsoft Windows NT 3.1 , the INI format was the only file format for storing program configurations that was supported by the WinAPI . As a format that is simply structured and at the same time easy to read by humans , it is also widely used across operating systems in order to permanently save program settings .

construction

The initialization data are stored line by line: an equal sign separates the key from its value.

Schlüssel=Wert

In order to group keys in so-called sections, a designation (unique for each file) must be given in square brackets above the respective section. Named sections are not mandatory, the keys for each section must be unique.

[Sektion1]
Schlüssel=Wert
[Sektion2]
Schlüssel=Wert
Schlüssel2=Wert

The file format also allows comment lines , which begin with a semicolon .

; Kommentar

The following rules must be observed when creating an INI file:

  • Each section can only appear once.
  • Each key may only appear once per section.
  • Values ​​are accessed using a section and key.
  • Comments are marked with a ";" initiated.
  • Comments may only be placed on separate lines (not after section headings or keys).
  • Spaces and quotation marks are sometimes treated differently by different programs.
  • No distinction is made between upper and lower case
  • Propositional logic : False and No are interpreted as 0, True and Yes as 1.

There are files with almost the same structure, which only differ in the following features:

  • Others (e.g. conf and cfg) or missing file extension
  • Introduction of comments with another character (e.g. "#" ).

An example of such a variation can be found in the configuration files for Subversion repositories.

Alternative formats

  • JSON (JavaScript Object Notation)
  • XML (Extensible Markup Language)
  • YAML (YAML Ain't Markup Language)
  • TOML (Tom's Obvious, Minimal Language)

Location

Example of a user-friendly selection option for specifying the storage location

In earlier Windows editions (with the introduction of NTFS ) there were two alternative / competing philosophies for the standard file path to the INI store, with user-friendliness on the one hand and security in the foreground on the other .

In the following using the example of Windows XP :

  • \Dokumente und Einstellungen\<Benutzername>\Anwendungsdaten\<Programmname>\
    (generally, a so-called environment variable : %APPDATA%\<Programmname>; in English: )\Documents and Settings\<Benutzername>\Application Data\<Programmname>\
  • \Programme\<Programmname>\
    (generally %PROGRAMFILES%\<Programmname>, English: )\Program Files\<Programmname>\

As of Windows Vista , changes to the programs folder by users with restricted rights (or non- administrators ) are blocked by default by the user account control, which also affects the INI files stored there. Some programs therefore assign all rights for the installed files to the user "Everyone" during installation . In these Windows versions, there may also be automatically generated copies of the INI files in the shadow directory $USERDIR$\AppData\Local\VirtualStore\Windows\ .

Applications that save their settings in their own program folder (for example %PROGRAMFILES%\<Programmname>\or %UserProfile%\Desktop\<Programmname>\) have the advantage that they can be transferred more easily to another computer, but have the disadvantage that all users of the application on one computer share these settings. Such applications are also referred to as portable . The prerequisite for changing these settings is that the user has write access to the INI file (and the program folder).

Web links