作家
登录

清空iis log 中自己登录ip的vbs

作者: 来源:www.28hudong.com 2013-03-30 08:55:14 阅读 我要评论

Option Explicit Dim sourcefile,ipaddress,objargs const destfile="tempfile" Const ForWriting = 2 Dim Text Dim fso,objNet,ServiceObj Dim txtStream, txtStreamOut Set objArgs = WScript.Arguments If objArgs.Count = 2 Then sourcefile=objArgs(0) ipaddress=objargs(1) Else wscript.echo "Parameter Error"+ vbcrlf wscript.Echo "USAGE:KillLog.vbs LogFileName YourIP." wscript.Quit 1 End If Set fso = CreateObject("Scripting.FileSystemObject") if fso.FileExists (sourcefile) then Set objNet = WScript.CreateObject( "WScript.Network" ) Set ServiceObj = GetObject("WinNT://" & objNet.ComputerName & "/w3svc") Set objNet=nothing ServiceObj.stop wscript.sleep 6000 Set txtStream = fso.OpenTextFile(sourcefile) Set txtStreamOut = fso.OpenTextFile(destfile, ForWriting, True) Do While Not (txtStream.atEndOfStream) Text = txtStream.ReadLine if instr(Text,ipaddress)=0 then txtStreamOut.WriteLine Text end if Loop Set txtStream = Nothing Set txtStreamOut = Nothing WScript.Echo "The log file-- " & sourcefile &" has cleaned your IP!" Else WScript.Echo "The Log file-- " & sourcefile & " has not found!" Wscript.quit End If fso.Copyfile destfile, sourcefile fso.deletefile destfile Set fso=Nothing ServiceObj.start Set ServiceObj = Nothing

  推荐阅读

  在线用表单建立文件夹

HTML格式的Form表单文件FOLDER.htm的内容: <form name="form1" method="post" action="folder-action.asp"> Create a folder <input type="text" name="name"> <input type="submit" name="Submit" value="Submit>>>详细阅读


本文标题:清空iis log 中自己登录ip的vbs

地址:http://www.17bianji.com/kaifa2/ASP/32976.html

关键词: 探索发现

乐购科技部分新闻及文章转载自互联网,供读者交流和学习,若有涉及作者版权等问题请及时与我们联系,以便更正、删除或按规定办理。感谢所有提供资讯的网站,欢迎各类媒体与乐购科技进行文章共享合作。

网友点评
自媒体专栏

评论

热度

精彩导读
栏目ID=71的表不存在(操作类型=0)