自己试过了再看下面的代码#include <File.au3>
$ini = IniReadSection('1.ini', '配置')
If @error Then Exit MsgBox(0, 1, @error)
$Dir = @ScriptDir & '\文件'
$File = _FileListToArray($Dir, '*.txt', 1)
If @error Then Exit MsgBox(0, 2, @error)
For $i = 1 To $File[0]
$s_File = $Dir & '\' & $File[$i]
$txt = FileRead($s_File)
For $ii = 1 To $ini[0][0]
$txt = StringReplace($txt, $ini[$ii][0], $ini[$ii][1])
Next
$fo = FileOpen($s_File, 2)
FileWrite($fo, $txt)
FileClose($fo)
Next
MsgBox(64, '完成', '已处理完成 ' & $File[0] & ' 个文件 ')
|