Board logo

标题: [问题求助] 【已解决】VBS能按文件列表处理文件吗?求助,vbs高手请进! [打印本页]

作者: 1270697389    时间: 2014-1-9 18:48     标题: 【已解决】VBS能按文件列表处理文件吗?求助,vbs高手请进!

本帖最后由 1270697389 于 2014-1-14 13:47 编辑
  1. Dim BinTemp, strUrl
  2. strUrl = "http://www.19lou.com/forum-26-thread-2601339311269947-1-1.html"
  3. With CreateObject("Msxml2.Xmlhttp")
  4.     .Open "get", strUrl, False
  5.     .Send
  6.     BinTemp = .ResponseBody
  7. End With
  8. With CreateObject("Adodb.Stream")
  9.     .Type = 1
  10.     .Mode = 3
  11.     .Open
  12.     .Write BinTemp
  13.     .SaveToFile "1-1.html"
  14.     .Close
  15. 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

  1. @echo off
  2. setlocal enabledelayedexpansion
  3. set "n="
  4. for /f "tokens=1-2 delims=," %%i in (www.txt) do (
  5.     set /a n+=1
  6.     set i=%%i
  7.     set /a r=!n!+1
  8.     set x=%%j
  9. if "!x!" == "001" (
  10. echo,Dim BinTemp, strUrl>vbsww!n!.vbs
  11. echo,strUrl = "!i!">>vbsww!n!.vbs
  12. echo,With CreateObject^("Msxml2.Xmlhttp"^) >>vbsww!n!.vbs
  13. echo,    ^.Open "get", strUrl, False >>vbsww!n!.vbs
  14. echo,    ^.Send >>vbsww!n!.vbs
  15. echo,BinTemp ^= ^.ResponseBody >>vbsww!n!.vbs
  16. echo,End With>>vbsww!n!.vbs
  17. echo,With CreateObject^("Adodb.Stream"^)>>vbsww!n!.vbs
  18. echo,    ^.^Type ^= ^1>>vbsww!n!.vbs
  19. echo,    ^.^Mode ^= ^3>>vbsww!n!.vbs
  20. echo,    ^.^Open>>vbsww!n!.vbs
  21. echo,    ^.Write BinTemp>>vbsww!n!.vbs
  22. echo,    ^.^SaveToFile "vbsxs\xs!n!.html">>vbsww!n!.vbs
  23. echo,    ^.^Close>>vbsww!n!.vbs
  24. echo,End With>>vbsww!n!.vbs
  25. echo,WScript.^Echo "全部执行完毕!OK">>vbsww!n!.vbs
  26. ) else (
  27. echo,Dim BinTemp, strUrl>vbsww!n!.vbs
  28. echo,strUrl = "!i!">>vbsww!n!.vbs
  29. echo,With CreateObject^("Msxml2.Xmlhttp"^) >>vbsww!n!.vbs
  30. echo,    ^.Open "get", strUrl, False >>vbsww!n!.vbs
  31. echo,    ^.Send >>vbsww!n!.vbs
  32. echo,BinTemp ^= ^.ResponseBody >>vbsww!n!.vbs
  33. echo,End With>>vbsww!n!.vbs
  34. echo,With CreateObject^("Adodb.Stream"^)>>vbsww!n!.vbs
  35. echo,    ^.^Type ^= ^1>>vbsww!n!.vbs
  36. echo,    ^.^Mode ^= ^3>>vbsww!n!.vbs
  37. echo,    ^.^Open>>vbsww!n!.vbs
  38. echo,    ^.Write BinTemp>>vbsww!n!.vbs
  39. echo,    ^.^SaveToFile "vbsxs\xs!n!.html">>vbsww!n!.vbs
  40. echo,    ^.^Close>>vbsww!n!.vbs
  41. echo,End With>>vbsww!n!.vbs
  42. echo,Dim objShell>>vbsww!n!.vbs
  43. echo,Set objShell = CreateObject^("WScript.Shell"^)>>vbsww!n!.vbs
  44. echo,objShell.Run "vbsww!r!.vbs">>vbsww!n!.vbs
  45. )
  46. )
  47. pause
复制代码





欢迎光临 批处理之家 (http://www.bathome.net/) Powered by Discuz! 7.2