ipclear.vbs源代碼
更新時(shí)間:2007年02月25日 00:00:00 作者:
復(fù)制代碼 代碼如下:
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
相關(guān)文章
用vbs將名稱截?cái)嘁允蛊渥疃喟?16 個(gè)字符的代碼
用vbs將名稱截?cái)嘁允蛊渥疃喟?16 個(gè)字符的代碼...2007-03-03VBS教程:VBscript語(yǔ)句-Execute 語(yǔ)句
VBS教程:VBscript語(yǔ)句-Execute 語(yǔ)句...2006-11-11SQL獲取表結(jié)構(gòu)的show_table.vbs (冰點(diǎn)極限NP)
SQL獲取表結(jié)構(gòu)的show_table.vbs,用vbs實(shí)現(xiàn)查看sql數(shù)據(jù)庫(kù)的表結(jié)構(gòu)的代碼。需要傳入用戶名密碼與數(shù)據(jù)庫(kù)名稱,具體的看程序幫助。2010-11-11