VBS:- Set fso = CreateObject("Scripting.FileSystemObject")
- For Each f in fso.GetFolder(".").Files
- ext = LCase(fso.GetExtensionName(f))
- If ext = "htm" or ext = "html" or ext = "txt" Then
- txt = fso.OpenTextFile(f).ReadAll
- fso.OpenTextFile(f & ".txt", 2, true).Write GetUrl(txt)
- End If
- Next
- MsgBox "OK"
-
- Function GetUrl(str)
- Set re = New RegExp
- re.Pattern = "http://[^""]+(?="")"
- re.Global = True
- re.IgnoreCase = True
- For Each m in re.Execute(str)
- If InStr(s, m & vbCrLf) = 0 Then s = s & m & vbCrLf
- Next
- GetUrl = s
- End Function
复制代码 BAT- //&cls&(type *.txt|cscript -nologo -e:jscript "%~0") 2>nul>>"批量提取%~nx0.txt"&pause&exit
- WSH.echo(WScript.StdIn.ReadAll().match(/http:\/\/[^\"]+(?=\")/g).join('\r\n'))
复制代码
|