[新手上路]批处理新手入门导读[视频教程]批处理基础视频教程[视频教程]VBS基础视频教程[批处理精品]批处理版照片整理器
[批处理精品]纯批处理备份&还原驱动[批处理精品]CMD命令50条不能说的秘密[在线下载]第三方命令行工具[在线帮助]VBScript / JScript 在线参考
返回列表 发帖

[问题求助] 【已解决】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不懂,谢谢各位老师,谢谢!
初九的冬天

  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
复制代码
初九的冬天

TOP

返回列表