本帖最后由 boyhong 于 2009-12-14 18:01 编辑
很痛苦。我现在检测到HOSTS文件里有:
12.12.12.12 www.xxxx.com.cn
这一行时,我只是拿一个""去替换掉这串字符,有没有办法将这一行彻底删除呀?#include <file.au3>
jctcohosts()
Func jctcohosts()
Dim $ajcRecords
If Not _FileReadToArray(@WindowsDir&"\system32\drivers\etc\hosts",$ajcRecords) Then
MsgBox(4096,"Error", " 没有找到HOSTS文件 错误代码是:" & @error)
Exit
EndIf
For $jx = 1 to $ajcRecords[0]
if $ajcRecords[$jx] ="12.12.12.12 www.xxxx.com.cn" Then
_FileWriteToLine(@WindowsDir&"\system32\drivers\etc\hosts",$ajcRecords[$jx], "", 1)
EndIf
Next
EndFunc
|