如何把.vbs脚本运行的结果输出到.txt
发布网友
发布时间:2024-10-24 10:01
我来回答
共1个回答
热心网友
时间:2024-10-25 02:14
Set oDOM=WScript.GetObject("http://www.ip138.com/ip2city.asp")
Do Until oDOM.readyState="complete"
WScript.sleep 200
Loop
'WScript.echo oDOM.documentElement.outerText
'将内容保存到 C:\ip138.txt 这个文件
Call WriteTextFile("c:\ip138.txt", oDOM.documentElement.outerText)
Set oDOM=nothing
Sub WriteTextFile(FileName, TextString)
Const ForReading = 1, ForWriting = 2, ForAppending = 8
Dim fso, f
Set fso = CreateObject("Scripting.FileSystemObject")
Set f = fso.OpenTextFile(FileName, ForWriting, True)
f.Write TextString
Set f = Nothing
Set fso = Nothing
End Sub