RunWait, %ComSpec% /c dir /b /A-D *.ini>%A_Temp%list.tmp, , Hide ;CMD获取文件列表 FileRead, list, %A_Temp%list.tmp ;读取 StringReplace, list, list, `r, , All ;替换回车符 StringSplit, file, list, `n, ;分割 Loop { if A_Index > %file0% Break tmpfile = % file%A_Index% FileRead, filecontent, %tmpfile% ;加载文件到变量 StringReplace, list, list, `r, , All StringSplit, line, filecontent, `n, , ;用函数分割变量为数组 Loop ;循环 { if A_Index > %line0% Break content = % line%A_Index% ;赋值当前行 StringReplace, content, content, `r, , All ;替换特殊字符 FKey := RegExMatch(content, ".*=.*") ;正则表达式匹配key if FKey = 1 { TKey := RegExReplace(content, "(.*)=.*", "$1") ;正则替换并赋值临时key TValue := RegExReplace(content, ".*=(.*)", "$1") ;正则替换并赋值临时value IfNotInString, Tkey, | ;不包含| %TKey% = %TValue% ;赋值 Else ;包含| { StringSplit, keys, TKey, |, ;分割 Loop ;循环赋值 { if A_Index > %keys0% Break tmpkey = % keys%A_Index% %tmpkey% = %TValue% } } } } } ListVars Pause