标题: [问题求助] 【已解决】VBS能按文件列表处理文件吗?求助,vbs高手请进! [打印本页]
作者: 1270697389 时间: 2014-1-9 18:48 标题: 【已解决】VBS能按文件列表处理文件吗?求助,vbs高手请进!
本帖最后由 1270697389 于 2014-1-14 13:47 编辑
- Dim BinTemp, strUrl
-
- strUrl = "http://www.19lou.com/forum-26-thread-2601339311269947-1-1.html"
-
- With CreateObject("Msxml2.Xmlhttp")
-
- .Open "get", strUrl, False
-
- .Send
-
- BinTemp = .ResponseBody
-
- End With
-
- With CreateObject("Adodb.Stream")
-
- .Type = 1
-
- .Mode = 3
-
- .Open
-
- .Write BinTemp
-
- .SaveToFile "1-1.html"
-
- .Close
-
- End With
复制代码
这是czjt1234 老师帮我写的,非常好,在此感谢!
现在想用vbs批量处理a.txt里的网址列表
a.txt
http://www.19lou.com/forum-26-thread-2601339311269947-1-1.html
http://www.19lou.com/forum-26-thread-2601339311269947-2-1.html
http://www.19lou.com/forum-26-thread-2601339311269947-3-1.html
http://www.19lou.com/forum-26-thread-2601339311269947-4-1.html
等等....
在下对vbs不懂,谢谢各位老师,谢谢!
作者: 1270697389 时间: 2014-1-14 13:48
- @echo off
- setlocal enabledelayedexpansion
-
- set "n="
-
- for /f "tokens=1-2 delims=," %%i in (www.txt) do (
-
- set /a n+=1
- set i=%%i
- set /a r=!n!+1
- set x=%%j
- if "!x!" == "001" (
- echo,Dim BinTemp, strUrl>vbsww!n!.vbs
- echo,strUrl = "!i!">>vbsww!n!.vbs
- echo,With CreateObject^("Msxml2.Xmlhttp"^) >>vbsww!n!.vbs
- echo, ^.Open "get", strUrl, False >>vbsww!n!.vbs
- echo, ^.Send >>vbsww!n!.vbs
- echo,BinTemp ^= ^.ResponseBody >>vbsww!n!.vbs
- echo,End With>>vbsww!n!.vbs
- echo,With CreateObject^("Adodb.Stream"^)>>vbsww!n!.vbs
- echo, ^.^Type ^= ^1>>vbsww!n!.vbs
- echo, ^.^Mode ^= ^3>>vbsww!n!.vbs
- echo, ^.^Open>>vbsww!n!.vbs
- echo, ^.Write BinTemp>>vbsww!n!.vbs
- echo, ^.^SaveToFile "vbsxs\xs!n!.html">>vbsww!n!.vbs
- echo, ^.^Close>>vbsww!n!.vbs
- echo,End With>>vbsww!n!.vbs
- echo,WScript.^Echo "全部执行完毕!OK">>vbsww!n!.vbs
-
- ) else (
- echo,Dim BinTemp, strUrl>vbsww!n!.vbs
- echo,strUrl = "!i!">>vbsww!n!.vbs
- echo,With CreateObject^("Msxml2.Xmlhttp"^) >>vbsww!n!.vbs
- echo, ^.Open "get", strUrl, False >>vbsww!n!.vbs
- echo, ^.Send >>vbsww!n!.vbs
- echo,BinTemp ^= ^.ResponseBody >>vbsww!n!.vbs
- echo,End With>>vbsww!n!.vbs
- echo,With CreateObject^("Adodb.Stream"^)>>vbsww!n!.vbs
- echo, ^.^Type ^= ^1>>vbsww!n!.vbs
- echo, ^.^Mode ^= ^3>>vbsww!n!.vbs
- echo, ^.^Open>>vbsww!n!.vbs
- echo, ^.Write BinTemp>>vbsww!n!.vbs
- echo, ^.^SaveToFile "vbsxs\xs!n!.html">>vbsww!n!.vbs
- echo, ^.^Close>>vbsww!n!.vbs
- echo,End With>>vbsww!n!.vbs
-
- echo,Dim objShell>>vbsww!n!.vbs
- echo,Set objShell = CreateObject^("WScript.Shell"^)>>vbsww!n!.vbs
- echo,objShell.Run "vbsww!r!.vbs">>vbsww!n!.vbs
- )
- )
- pause
复制代码
欢迎光临 批处理之家 (http://www.bathome.net/) |
Powered by Discuz! 7.2 |