Ini (.ini)

Background & Context

    • Configuration file format.
    • Composed of sections.
    • Associates string keys to string values.
    • Stores configurations for operating systems and software.
    • Plain text format.

Import & Export

  • Import["file.ini"] returns a representation of an Ini file as an Association.
  • Import["file","Ini"] returns a representation of a file as an Ini file.
  • Import["file.ini",elem] returns the specified data representation of an Ini file.
  • Import["file",{"Ini",elem}] returns the specified data representation of a file.
  • See the following reference pages for full general information:
  • Import, Exportimport from or export to a file
    CloudImport, CloudExportimport from or export to a cloud object
    ImportString, ExportStringimport from or export to a string
    ImportByteArray, ExportByteArrayimport from or export to a byte array

Import Elements

  • General Import elements:
  • "Elements" list of elements and options available in this file
    "Rules"list of rules for all available elements
  • Data representation elements:
  • "Data"data as an association
    "DataRules"data as a list of rules
    "AnnotatedData"data as a list of sections as rules, and comments as strings
  • The Ini format exports elements of an association or a list.
  • "Ini" treats an association as a list of sections. The keys specify the section names; the values specify the elements of a section as associations. Expressions are converted to their input form string representation.
  • "Ini" accepts lists containing a mixture of rules and strings. Rules are exported as sections; strings are exported as commented lines.
  • A commented line starts with ";".


Basic Examples  (6)

Export an association as a section with properties:

Create a file:

Add a section and few properties to it:

Import it as an Ini file:

Create a file:

Write properties and comments to it:

Import the data only, as an Association:

Import the data and the comment:

Whitespace characters are not trimmed:

Sections must start with the character "[" and finish with "]":

Commented lines must start with the character ";":

Arbitrary expressions are converted to strings using InputForm: