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

[转贴] VBScript脚本解压缩目录中的所有zip文件

  1. On Error Resume Next
  2. Dim objFSO,sourcepath,targetpath
  3. Function GetZipFile(path)
  4. Dim file,folder,sfolder,subfolder,files
  5. If Not objFSO.FolderExists(path) Then
  6. Msgbox "目标文件夹不存在!"
  7. Else
  8. objFSO.CreateFolder targetpath & Right(path,Len(path)-Len(sourcepath))
  9. Set folder=objFSO.GetFolder(path)
  10. Set files=folder.files
  11. For Each file in files
  12. If StrComp(objFSO.GetExtensionName(file.name),"zip",vbTextCompare)=0 Then
  13. objShell.NameSpace(targetpath & Right(path,Len(path)-Len(sourcepath))).CopyHere objShell.NameSpace(path & "\" & file.name).Items(),256
  14. End If
  15. Next
  16. Set subfolder=folder.subfolders
  17. For Each sfolder in subfolder
  18. GetZipFile path & "\" & sfolder.name
  19. Next
  20. End If
  21. End Function
  22. Set objFSO=Server.CreateObject("Scripting.FileSystemObject")
  23. Set oApp=CreateObject("Shell.Application")
  24. sourcepath="C:\zipfiles"
  25. targetpath="D:\tmp\" & objFSO.GetFileName(sourcepath)
  26. GetZipFile sourcepath
  27. Set objFSO=Nothing
  28. Set oApp=Nothing
复制代码

http://www.jb51.net/article/29533.htm

返回列表