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

VBS获取IE缓存中的音乐文件

  1. On Error Resume Next
  2. Dim Fso,Filenum,Dirnum,sPath,TmpType,newFP
  3. IF MsgBox("请确定已经先打开浏览器,开始在线视听!",vbYesNo,"提示") = vbNo Then
  4. Wscript.Quit
  5. Else
  6. Set Fso = Wscript.CreateObject("Scripting.FileSystemobject")
  7. Set Wfolder=Fso.getspecialfolder(2)
  8. Filenum = 0
  9. Dirnum = 0
  10. sPath = left(Wscript.ScriptFullName,len(Wscript.ScriptFullName)-len(Wscript.ScriptName))
  11. TmpPath = trim(CreateObject("Wscript.Shell").ExpandEnvironmentStrings("%USERPROFILE%") & "\Local Settings\Temporary Internet Files\")
  12. FileType = LCase(Inputbox("wma、wav、flv、swf、mp3、mid、或其它类型","文件类型:","wma"))
  13. newFP=LCase(Inputbox("请输入文件存放路径:","存放路径","D:\TempFile"))
  14. if right(newFP,1) <> "\" then
  15. newFP = newFP & "\"
  16. end if
  17. if (fso.folderexists(newFP)) then
  18. FindFiles TmpPath
  19. else
  20. set foldr=fso.createfolder(newFP)
  21. FindFiles TmpPath
  22. end if
  23. end if
  24. if msgbox("文件提取完成!" & vbCrLf & vbCrLf & vbCrLf & "是否需要打开 " & newFP & vbcrlf,vbYesNo,"执行结果") = vbYes Then
  25. set cmd=createobject("wscript.shell")
  26. cmd.run newFP
  27. else
  28. wscript.quit
  29. end if
  30. Sub FindFiles(ByVal FPath)
  31. On Error Resume  Next
  32. Dim fso, myFolder, myFile, curFolder
  33. Set fso = wscript.CreateObject("scripting.filesystemobject")
  34. Set curFolders = fso.getfolder(FPath)
  35. Dirnum = Dirnum + 1
  36. If curFolders.Files.Count > 0 Then
  37. For Each myFile In curFolders.Files
  38. If InStr(1, LCase(myFile.Name), FileType) > 0 Then
  39. filepath = FormatPath(FPath) & "\" & myFile.Name
  40. fso.deletefile(filepath)
  41. if fso.fileexists(filepath) then
  42. if msgbox("是否需要为被提取文件重命名?" , vbYesNo , "提示" ) = vbYes then
  43. fso.copyfile filepath,newFP & inputbox("请输入新文件名:","提示","NewFile") & "." & filetype,true
  44. else
  45. fso.copyfile filepath,newFP,true
  46. end if
  47. end if
  48. Filenum = Filenum + 1
  49. End If
  50. Next
  51. End If
  52. If curFolders.subfolders.Count > 0 Then
  53. For Each myFolder In curFolders.subfolders
  54. FindFiles FormatPath(FPath) & "\" & myFolder.Name
  55. Next
  56. End If
  57. End Sub
  58. Function FormatPath(ByVal FPath)
  59. FPath = Trim(FPath)
  60. FormatPath = FPath
  61. If Right(FPath, 1) = "\" Then FormatPath = Mid(FPath, 1, Len(FPath) - 1)
  62. End Function
复制代码
我帮忙写的代码不需要付钱。如果一定要给,请在微信群或QQ群发给大家吧。
【微信公众号、微信群、QQ群】http://bbs.bathome.net/thread-3473-1-1.html
【支持批处理之家,加入VIP会员!】http://bbs.bathome.net/thread-67716-1-1.html

缓存中的东东,VBS可以直接用FSO操作的么,第一次知道。。。

TOP

返回列表