AutoIT-查找文件内容并修改保存
#include <File.au3> #include <Array.au3> Local $aRecords If Not _FileReadToArray("E:\server.ini", $aRecords) Then MsgBox(4096, "错误", " Error reading log to Array error:" & @error) Exit EndIf _ArrayDisplay($aRecords) For $x = 1 To $aRecords[0] ;MsgBox(4096, 'Record:' & $x, $aRecords[$x]) Local $result = StringInStr($aRecords[$x], "VERSION") ;找到了要比较的内容 If $result > 0 Then ;MsgBox(0,"","1.,找到") ;匹配内容,再替换数组内容 Local $sOutput = StringRegExpReplace($aRecords[$x], "VERSION", "****.") $aRecords[$x] = $sOutput EndIf Next _FileWriteFromArray("E:\server.ini", $aRecords, 1)
posted on 2012-08-22 21:49 One|Piece 阅读(2136) 评论(0) 编辑 收藏 举报