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

显示解压、复制文件的进度[只能解压ZIP文件]

  1. Option Explicit
  2. ' 解压 E:\deep.zip 到 E:\test1 目录下
  3. Extract "E:\deep.zip", "E:\test1"
  4. ' 复制 E:\test1 目录下内容到 E:\test2
  5. Extract "E:\test1", "E:\test2"
  6. Sub Extract(ByVal myZipFile, ByVal myTargetDir)
  7.     Dim intOptions, objShell, objSource, objTarget
  8.     Set objShell = CreateObject("Shell.Application")
  9.     Set objSource = objShell.NameSpace(myZipFile).Items()
  10.     Set objTarget = objShell.NameSpace(myTargetDir)
  11.     intOptions = 256
  12.     objTarget.CopyHere objSource, intOptions
  13.     Set objShell  = Nothing
  14.     Set objSource = Nothing
  15.     Set objTarget = Nothing
  16. End Sub
  17. '       System.Shell.Folder.CopyHere() 方法的语法格式:
  18. '              System.Shell.Folder.copyHere(oItem [, intOptions])
  19.     ' 以下是CopyHere() 方法可用的 intOptions 值, 可参考MSDN (http://msdn2.microsoft.com/en-us/library/ms723207.aspx).
  20.     '      0: Default. No options specified.  
  21.     '      4: Do not display a progress dialog box.
  22.     '      8: Rename the target file if a file exists at the target location with the same name.
  23.     '     16: Click "Yes to All" in any dialog box that is displayed.
  24.     '     64: Preserve undo information, if possible.
  25.     '    128: Perform the operation on files only if a wildcard file name (*.*) is specified.  
  26.     '    256: Display a progress dialog box but do not show the file names.
  27.     '    512: Do not confirm the creation of a new directory if the operation requires one to be created.
  28.     '   1024: Do not display a user interface if an error occurs.
  29.     '   4096: Disable recursion. Only operate in the local directory.Don't operate recursively into subdirectories.
  30.     '   9182: Do not copy connected files as a group. Only copy the specified files.
复制代码

[ 本帖最后由 somebody 于 2007-11-14 01:05 编辑 ]
Software is like sex: it's better when it's free..!

返回列表