ini文件定义
https://en.wikipedia.org/wiki/INI_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.[1]
INI文件格式是一种非正式的配置文件标准,对于一些软件和平台使用。
INI文件是简单的文本文件,带有基本的结构,由 section property 和 value组成。
In MS-DOS and 16-bit Windows platforms up through Windows ME, the INI file served as the primary mechanism to configure operating system and installed applications features, such as device drivers, fonts, startup launchers, and things that needed to be initialized in booting Windows. INI files were also generally used by applications to store their individual settings.[2]
Starting with Windows NT, Microsoft favored the use of the registry, and began to steer developers away from using INI files for configuration. All subsequent versions of Windows have used the Windows Registry for system configuration, and applications built on the .NET Framework use special XML .config files. The APIs still exist in Windows, however, and developers may still use them.
为微软早期使用的配置伟岸格式,配置操作系统 和 安装的软件功能,例如设备驱动、字体、启动发射台,和其他在启动过程中使用的参数。
后来从NT开始,微软使用注册表,配置操作系统,应用软件使用xml文件配置。使用INI越来越少。
The name "INI file" comes from the commonly used filename extension
.INI
, which stands for "initialization". Other common initialization file extensions are.CFG
,.conf
,[3] and.TXT
,[4] especiallyCONFIG.SYS
and 'config.txt' occurrences.Linux and Unix systems also use a similar file format for system configuration. In addition, platform-agnostic software may use this file format for configuration. It is human-readable and simple to parse, so it is a usable format for configuration files that do not require much greater complexity.
INI文件来自于经常使用的文件后缀 .INI, 表示初始化。 Linux也有使用。 其容易阅读,并且简单。
格式
https://en.wikipedia.org/wiki/INI_file
Keys (properties)
The basic element contained in an INI file is the key or property. Every key has a name and a value, delimited by an equals sign (
=
). The name appears to the left of the equals sign.Note: In the Windows implementation the key cannot contain the characters equal sign (
=
) or semi colon (;
) as these are reserved characters. The value can contain any character.name=valueSections
Keys may (but need not) be grouped into arbitrarily named sections. The section name appears on a line by itself, in square brackets (
[
and]
). All keys after the section declaration are associated with that section. There is no explicit "end of section" delimiter; sections end at the next section declaration, or the end of the file. Sections may not be nested.Note: In the Windows implementation the section cannot contain the character closing bracket (
]
).[section] a=a b=bCase insensitivity
Section and property names are not case sensitive in the Windows implementation.[8]
Comments
Semicolons (
;
) at the beginning of the line indicate a comment. Comment lines are ignored.; comment text
https://www.cnblogs.com/renyuan/p/4111695.html
INI文件由节、键、值组成。
节
[section]参数(键=值)
name=value注解
注解使用分号表示(;)。在分号后面的文字,直到该行结尾都全部为注解。NI文件的格式很简单,最基本的三个要素是:parameters,sections和comments。
什么是parameters?
INI所包含的最基本的“元素”就是parameter;每一个parameter都有一个name和一个value,name和value是由等号“=”隔开。name在等号的左边。
如:
name = value
什么是sections ?
所有的parameters都是以sections为单位结合在一起的。所有的section名称都是独占一行,并且sections名字都被方括号包围着([ and ])。在section声明后的所有parameters都是属于该section。对于一个section没有明显的结束标志符,一个section的开始就是上一个section的结束,或者是end of the file。Sections一般情况下不能被nested,当然特殊情况下也可以实现sections的嵌套。
section如下所示:
[section]
什么是comments ?
在INI文件中注释语句是以分号“;”开始的。所有的所有的注释语句不管多长都是独占一行直到结束的。在分号和行结束符之间的所有内容都是被忽略的。
注释实例如下:
;comments text
NON GNU INI
http://www.nongnu.org/chmspec/latest/INI.html
INI files are text files with CRLF line endings. They are divided into uniquely named sections. The beginning each of section is denoted by a line of the following form: "[section type]" where section type is a series of words. Each section type is followed by lines up to the next section that specify data for that section and each different section type may have a different format.
There are two main types of format following the section type: Each line is variable = value[, value]… Each line is a just an EOL terminated string.
The following variables are used below in the description of values in the different format descriptions:
- bool
Yes|No
- decimal number
(0|1|2|3|4|5|6|7| 8|9)…
- hex number
0x(0|1|2|3|4|5|6| 7|8|9|a|b|c|d|e| f|A|B|C|D|E|F)…
- number
hex number|decimal number
- string
Any character (usually alphanumerics plus underscore) repeated up to the terminator (usually EOL, also '=' or '"')
- path
Similar to string, but a file with the same name should exist