autoit基础 IniRead 读取ini配置文件中的数据

网友投稿 1071 2022-09-13

autoit基础 IniRead 读取ini配置文件中的数据

autoit基础 IniRead 读取ini配置文件中的数据

OS : Windows 10 Version 21H1       AutoIt : v3.3.16.0        blog : 师万物  typesetting : Markdown

script

my.ini

[section] key1=value1 key2=value2 key3=value3 [section1] key1=value1 key2=value2 key3=value3_new

#include Global $result #comments-start IniRead ( "filename", "section", "key", "default" ) Reads a value from a standard format .ini file. #comments-end ;读取指定ini文件 - 指定section - 指定key的value值 $result = IniRead(@DesktopDir & "\my.ini","section", "key1", "the requested key is not found") ConsoleWrite($result) ConsoleWrite(@CRLF) #comments-start IniReadSection ( "filename", "section" ) Reads all key/value pairs from a section in a standard format .ini file. #comments-end ;读取ini文件中指定Section中的key-value ;$sectionArr[0][0]是个数 Local $sectionArr[][] = IniReadSection(@DesktopDir & "\my.ini","section") If Not @error Then For $i = 1 To $sectionArr[0][0] ConsoleWrite($sectionArr[$i][0] & "-" & $sectionArr[$i][1]) ConsoleWrite(@CRLF) Next EndIf ConsoleWrite(@CRLF) #comments-start IniReadSectionNames ( "filename" ) Reads all sections in a standard format .ini file. #comments-end ;读取ini文件中所有的Section名 Local $sectionNamesArr[] = IniReadSectionNames(@DesktopDir & "\my.ini") If Not @error Then For $i = 1 To $sectionNamesArr[0] ConsoleWrite($sectionNamesArr[$i]) ConsoleWrite(@CRLF) Next EndIf

Go

>"D:\Develop\AutoIt3\SciTE\..\AutoIt3.exe" /ErrorStdOut "E:\autoit\demo.au3" value1 key1-value1 key2-value2 key3-value3 section section1 >Exit code: 0

学习资源

autoit autoit-docs IT天空 msdn 51CTO社区

版权声明:本文内容由网络用户投稿,版权归原作者所有,本站不拥有其著作权,亦不承担相应法律责任。如果您发现本站中有涉嫌抄袭或描述失实的内容,请联系我们jiasou666@gmail.com 处理,核实后本网站将在24小时内删除侵权内容。

上一篇:泛型Generic(泛型编程)
下一篇:autoit基础 IniDelete 删除ini配置文件中的数据
相关文章

 发表评论

暂时没有评论,来抢沙发吧~