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