GO-Ve01
ServicesDevelopersBooksDictionaryPapersWikidataEncyclopediaSearchBabelCareersDeck

INI file

An INI file is a configuration file for computer software that consists of plain text with a structure and syntax comprising key–value pairs organized in sections. The name of these configuration files comes from the filename extension INI, short for initialization, used in the MS-DOS operating system, which popularized this method of software configuration. The format has become an informal standard in many contexts of configuration, but many applications on other operating systems use different filename extensions, such as conf and cfg. Source: e01 Encyclopedia. Licence: CC BY-SA 4.0.

An INI file is a configuration file for computer software that consists of plain text with a structure and syntax comprising key–value pairs organized in sections. The name of these configuration files comes from the filename extension INI, short for initialization, used in the MS-DOS operating system, which popularized this method of software configuration. The format has become an informal standard in many contexts of configuration, but many applications on other operating systems use different filename extensions, such as conf and cfg. last modified 1 April 2001 by John Doe [owner] name = John Doe organization = Acme Widgets Inc. [database] use IP address in case network name resolution is not working server = 192.0.2.62 port = 143 file = "payroll.dat" Data in INI is held in key–value pairs called key or property. Key may thus either refer to the entire key–value pair or only its key. In some contexts a key is called a property name. In its textual representation, the key–value pair is represented by either a line or a multiline where the start of the value is indicated by a delimiter, most often an equals sign ( = , ASCII 0x3D) but sometimes also a colon ( : , ASCII 0x3A) or whitespace (occasionally used in the GNU world ). The key's key appears to the left of the delimiter, is often non-empty and should not contain the delimiter. Some flavours allow escape sequences in the value. In the Windows implementation, the equals sign and the semicolon are reserved characters and cannot appear in the key. Any whitespace surrounding the key is stripped by the parser. The value can contain any character (in Windows-style, no whitespace surrounds the delimiter: e.g. IconFile=Folder.ico ). Key–value pairs may textually look like: key=key=v name =value sem=; semver=v5822.433.2 [project] name = orchard rental service (with app) target region = "Bay Area" TODO: advertise vacant positions legal team = (vacant) [fruit "Apple"] trademark issues = foreseeable taste = known [fruit.Date] taste = novel Trademark Issues="truly unlikely" [fruit "Raspberry"] anticipated problems ="logistics (fragile fruit)" Trademark Issues=\ possible [fruit.raspberry.proponents.fred] date = 2021-11-23, 08:54 +0900 comment = "I like red fruit." [fruit "Date/proponents/alfred"] comment: Why, \ \ \ I would buy dates. folding: Is "\\\\\nn" interpreted as "\\n" or "\n"? Or does "\\\\" prevent folding? editor =My name may contain a \\ newline. [section] domain = example.com [section.subsection] foo = bar In some cases relative nesting is supported too, where a leading dot expresses nesting to the previous section: [section] domain = example.com [.subsection] foo = bar Historically, ways for expressing nesting alternative to the dot have existed too (for example, IBM's driver file for Microsoft Windows devlist.ini , in which the backslash was used as nesting delimiter in the form of [A\B\C] ; or Microsoft Visual Studio's AEMANAGR.INI file, which used a completely different syntax in the form of [A] and B,C,P = V ). Some parsers did not offer nesting support at all and were hierarchy-blind, but nesting could still be partially emulated by exploiting the fact that [A.B.C] constitutes a unique identifier. ! /bin/convert-ini-to-perl | perl | ssh wikipedia.org upload --sanitise=no Ambiguous without further knowledge of the INI dialect: is the value "live" or "live # dangerously"? I like to = live # dangerously var = a var = a ; This is an inline comment foo = bar # This is another inline comment Under the WinAPI's GetPrivateProfileString 's dialect, comments must occur on lines by themselves. include int main(int argc, TCHAR *argv[]) { TCHAR dbserver[1000]; int dbport; GetPrivateProfileString(TEXT("database"), TEXT("server"), TEXT("127.0.0.1"), dbserver, sizeof(dbserver) / sizeof(dbserver[0]), TEXT(".\\dbsettings.ini")); dbport = GetPrivateProfileInt(TEXT("database"), TEXT("port"), 143, TEXT(".\\dbsettings.ini")); // N.B. WritePrivateProfileInt() does not exist, only WritePrivateProfileString() return 0; } The third parameter of the function is the default value, which are and respectively in the two function calls above. If the argument supplied for this parameter is , the default is an empty string, . Under Unix, many different configuration libraries exist to access INI files. They are often already included in frameworks and toolkits. Examples of INI parsers for Unix include GLib, iniparser and libconfini. GetPrivateProfileString("owner", "name", ... , "c:\\programs\\oldprogram\\dbsettings.ini"); INI mapping takes this Profile API call, ignores any path in the given filename and checks to see if there is a Registry key matching the filename under the directory: HKEY_LOCAL_MACHINE\Software\Microsoft\Windows NT\ CurrentVersion\IniFileMapping If this exists, it looks for an entry name matching the requested section. If an entry is found, INI mapping uses its value as a pointer to another part of the Registry. It then looks up the requested INI setting in that part of the Registry. If no matching entry name is found and there is an entry under the entry name, INI mapping uses that instead. Thus each section name does not need its own entry. So, in this case the profile call for the [owner] section is mapped through to: where the " " Registry entry name is found to match the requested INI key. The value of "John Doe" is then returned to the Profile call. In this case, the @ prefix on the default prevents any reads from going to the file on disk. The result is that any settings not found in the Registry are not looked for in the INI file. The " " Registry entry does not have the prefix on the value; thus, for the [database] section only, settings in the Registry are taken first followed by settings in the file on disk.

source: e01 Encyclopedia · licence: CC BY-SA 4.0 · page · source revision

Cite this

"INI file". 1791104540. e01 Encyclopedia. CC BY-SA 4.0. https://en.wikipedia.org/w/index.php?oldid=1378419732

JSON record · API collection · BibTeX · RIS · CSL-JSON · citation policy

Save to pass ·