呵呵,借鉴 electronixtar 的代码,保存为 filename.vbs,把要提取的html文件拖到他上面去就行了:
htmlFile = WScript.Arguments(0)
textString = ""
With GetObject(htmlFile )
do until .readyState = "complete"
WScript.sleep 200
loop
For Each a In .GetElementsByTagName("a")
textString = textString & a.innerText & vbCrLf & a.href & vbCrLf & vbCrLf
Next
End With
CreateObject("Scripting.FileSystemObject").CreateTextFile(htmlFile & ".txt", True).Write textString
MsgBox "提取到文本文件 " & htmlFile & ".txt", 4160, "完成"