選項顯式
昏暗的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 =沒有