国产片侵犯亲女视频播放_亚洲精品二区_在线免费国产视频_欧美精品一区二区三区在线_少妇久久久_在线观看av不卡

腳本之家,腳本語言編程技術(shù)及教程分享平臺!
分類導(dǎo)航

Python|VBS|Ruby|Lua|perl|VBA|Golang|PowerShell|Erlang|autoit|Dos|bat|

服務(wù)器之家 - 腳本之家 - VBS - 用vbs實現(xiàn)zip功能的腳本

用vbs實現(xiàn)zip功能的腳本

2020-07-17 11:09VBS代碼網(wǎng) VBS

本文主要講解用vbs腳本實現(xiàn)zip壓縮及解壓縮功能的實現(xiàn)方法,有需要的朋友可以參考下

壓縮: 

  1. Function fZip(sSourceFolder,sTargetZIPFile)  
  2. 'This function will add all of the files in a source folder to a ZIP file  
  3. 'using Windows' native folder ZIP capability.  
  4. Dim oShellApp, oFSO, iErr, sErrSource, sErrDescription  
  5. Set oShellApp = CreateObject("Shell.Application")  
  6. Set oFSO = CreateObject("Scripting.FileSystemObject")  
  7. 'The source folder needs to have a \ on the End  
  8. If Right(sSourceFolder,1) <> "\" Then sSourceFolder = sSourceFolder & "\"  
  9. On Error Resume Next   
  10. 'If a target ZIP exists already, delete it  
  11. If oFSO.FileExists(sTargetZIPFile) Then oFSO.DeleteFile sTargetZIPFile,True   
  12. iErr = Err.Number  
  13. sErrSource = Err.Source  
  14. sErrDescription = Err.Description  
  15. On Error GoTo 0  
  16. If iErr <> 0 Then     
  17. fZip = Array(iErr,sErrSource,sErrDescription)  
  18. Exit Function  
  19. End If  
  20. On Error Resume Next  
  21. 'Write the fileheader for a blank zipfile.  
  22. oFSO.OpenTextFile(sTargetZIPFile, 2, True).Write "PK" & Chr(5) & Chr(6) & String(18, Chr(0))  
  23. iErr = Err.Number  
  24. sErrSource = Err.Source  
  25. sErrDescription = Err.Description  
  26. On Error GoTo 0  
  27. If iErr <> 0 Then     
  28. fZip = Array(iErr,sErrSource,sErrDescription)  
  29. Exit Function  
  30. End If  
  31. On Error Resume Next   
  32. 'Start copying files into the zip from the source folder.  
  33. oShellApp.NameSpace(sTargetZIPFile).CopyHere oShellApp.NameSpace(sSourceFolder).Items  
  34. iErr = Err.Number  
  35. sErrSource = Err.Source  
  36. sErrDescription = Err.Description  
  37. On Error GoTo 0  
  38. If iErr <> 0 Then     
  39. fZip = Array(iErr,sErrSource,sErrDescription)  
  40. Exit Function  
  41. End If  
  42. 'Because the copying occurs in a separate process, the script will just continue. Run a DO...LOOP to prevent the function  
  43. 'from exiting until the file is finished zipping.  
  44. Do Until oShellApp.NameSpace(sTargetZIPFile).Items.Count = oShellApp.NameSpace(sSourceFolder).Items.Count  
  45.    WScript.Sleep 1500'如果不成功,增加一下秒數(shù)  
  46. Loop  
  47. fZip = Array(0,"","")  
  48. End Function   
  49.  
  50. Call fZip ("C:\vbs","c:\vbs.zip")   

解壓縮: 
 

  1. Function fUnzip(sZipFile,sTargetFolder)  
  2. 'Create the Shell.Application object  
  3. Dim oShellApp:Set oShellApp = CreateObject("Shell.Application")  
  4. 'Create the File System object  
  5. Dim oFSO:Set oFSO = CreateObject("Scripting.FileSystemObject")  
  6. 'Create the target folder if it isn't already there  
  7. If Not oFSO.FolderExists(sTargetFolder) Then oFSO.CreateFolder sTargetFolder  
  8. 'Extract the files from the zip into the folder  
  9. oShellApp.NameSpace(sTargetFolder).CopyHere oShellApp.NameSpace(sZipFile).Items  
  10. 'This is a seperate process, so the script would continue even if the unzipping is not done  
  11. 'To prevent this, we run a DO...LOOP once a second checking to see if the number of files  
  12. 'in the target folder equals the number of files in the zipfile. If so, we continue.  
  13. Do  
  14. WScript.Sleep 1000‘有時需要更改  
  15. Loop While oFSO.GetFolder(sTargetFolder).Files.Count < oShellApp.NameSpace(sZipFile).Items.Count  
  16. End Function  

延伸 · 閱讀

精彩推薦
主站蜘蛛池模板: 国产精品久久久久久久9999 | 日韩视频在线一区二区 | 欧美福利视频 | 色视在线| 国产精品久久久久久久久久久久久 | www久| 日韩精品在线视频 | 美女福利网站 | 免费一级黄色 | 嫩草视频在线 | 99久久精品一区二区成人 | 国产精品久久久久久av公交车 | 午夜国产影院 | 欧美激情综合网 | 日韩精品一区二区三区中文字幕 | a级毛片免费高清视频 | 激情网激情五月 | 国产视频一区二区 | 亚洲一区精品在线 | 美女久久久久 | 色视频www在线播放国产人成 | 毛片国产 | 四虎久久精品 | 亚洲综合在线视频 | 中文在线观看www | 国产毛片毛片 | 日韩影院在线 | 欧美1级片 | 91精品国产综合久久香蕉 | 欧美黄色免费网址 | 欧美亚洲在线 | 成人片免费看 | 免费观看黄视频 | 少妇精品久久久久久久久久 | 一级毛片免费看 | 亚洲久草| 精品一区二区视频 | 欧美日韩高清在线观看 | 综合色爱 | 99国产精品99久久久久久 | 国产一级片 |