回复 5# a000001 - On Error Resume Next
- Set fso = CreateObject("Scripting.FileSystemObject")
- Set dict = CreateObject("Scripting.Dictionary")
- Set f = fso.OpenTextFile(wscript.scriptfullname, 1)
- Do Until f.AtEndOfStream
- str = Trim(f.ReadLine)
- IF Left(str,1)="'" Then dict.Add mid(str,2), "1"
- Loop
- f.Close
-
- Set fso = CreateObject("Scripting.FileSystemObject")
- Set fd = fso.GetSpecialFolder(1)
- HostsFile = fd & "\Drivers\etc\Hosts"
-
- Set objFile = fso.GetFile(HostsFile)
- If objFile.Attributes And 1 Then
- objFile.Attributes = objFile.Attributes -1
- End If
-
- Set f = fso.OpenTextFile(HostsFile, 1)
- Do Until f.AtEndOfStream
- str = f.ReadLine
- If not dict.Exists(Trim(str)) Then
- txt = txt & str & vbCrLf
- End If
- Loop
- f.Close
- Set f = fso.OpenTextFile(HostsFile, 2)
- f.Write txt
- f.Close
-
- '127.0.0.1 mcfg.sandai.net
- '127.0.0.1 211.94.190.80
- '127.0.0.1 advstat.xunlei.com
- '123.87.86.5 biz5.sandai.net
- '527.66.13.125 cknum.sandai.net
- '110.45.215.113 cl.kankan.xunlei.com
- '127.0.0.1 float.sandai.net
- '180.70.134.154 mtips.xunlei.com
- '127.0.0.1 pubstat.sandai.net
- '216.58.221.74 recommend.xunlei.com
- '127.0.0.1 wy.xunlei.com
- '110.45.229.148 buy.safe.xunlei.com
复制代码
|