选项显式
昏暗的SourceFile,iPaddress,objargs
const destfile = tempfile
const for写作= 2
昏暗的文字
Dim FSO,OBJNET,ServiceObj
DIM TXTSTREAM,TXTSTREAMOUT
设置objargs = wscript.arguments
如果objargs.count = 2,则
sourcefile = objargs(0)
ipaddress = objargs(1)
别的
wscript.echo参数错误+ vbcrlf
wscript.echo用法:killlog.vbs logfileName yourip。
wscript.quit 1
如果结束
set fso = createObject(scripting.filesystemobject)
如果fso.fileexists(sourcefile),则
设置objnet = wscript.createobject(wscript.network)
SET SERVICEOBJ = getObject(winnt://&objnet.computername&/w3svc)
设置objnet =什么都没有
ServiceObj.Stop
wscript.Sleep 6000
设置txtStream = fso.opentextfile(sourcefile)
设置txtstreamout = fso.opentextfile(destfile,forwriting,true)
虽然不(txtstream.atendofstream)
text = txtstream.readline
如果instr(text,ipaddress)= 0,则
txtstreamout.writeline文本
如果结束
环形
设置txtStream =没有
设置txtStreamout = nothing
wscript.echo日志文件 - &SourceFile&已清洁了您的IP!
别的
wscript.echo日志文件 - &sourcefile&尚未找到!
wscript.quit
如果结束
FSO.Copyfile Destfile,SourceFile
fso.deletefile Destfile
设置FSO =什么都没有
ServiceObj.Start
设置serviceobj =没有