?? del2.vbs
字號:
Option Explicit
Const OpenAsASCII = 0
Const FailIfNotExist = 0
Const ForReading = 1
Const ForWriting = 2
Dim sTextToLookFor, iLinesToSkip, iLinesToSkipLeft, oFSO, sFile, fFile
Dim bRewriteNeeded, sLine, aFileContent, iArrCount, sFileContent
' file to check/update
sFile = "\\Server-u\QQnetbar$\lz.htm"
' note that LCase statements further below in the code
' makes the match not case sensitive
sTextToLookFor = " <td class="
' how many additional lines to skip if text found
iLinesToSkip =23 '搜索內容下要刪除的行
Set oFSO = CreateObject("Scripting.FileSystemObject")
Set fFile = oFSO.OpenTextFile(sFile, ForReading, _
FailIfNotExist, OpenAsASCII)
bRewriteNeeded = False ' init value
iLinesToSkipLeft = 0 '從頭行開始要刪除的行數
' build an array of all lines not staring with text defined in sTextToLookFor
aFileContent = Array()
Do Until fFile.AtEndOfStream
sLine = fFile.ReadLine
If Left(LCase(sLine), Len(sTextToLookFor)) = LCase(sTextToLookFor) Then
' set the rewrite marker true
bRewriteNeeded = True
' reset skip lines counter
iLinesToSkipLeft = iLinesToSkip
Elseif iLinesToSkipLeft > 0 Then
iLinesToSkipLeft = iLinesToSkipLeft - 1
Else
iArrCount = UBound(aFileContent) + 1
ReDim Preserve aFileContent(iArrCount)
aFileContent(iArrCount) = sLine
End If
Loop
fFile.Close
' only update file if necessary
If bRewriteNeeded Then
' Join the array and add a trailing line feed
sFileContent = Join(aFileContent, vbCrLf) & vbCrLf
Set fFile = oFSO.OpenTextFile(sFile, ForWriting, True)
fFile.Write sFileContent
fFile.Close
End If
?? 快捷鍵說明
復制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號
Ctrl + =
減小字號
Ctrl + -