以下是引用aaaaaa在2016-6-11 21:43:06的发言:
Clear
lcZip = UnZip("C:\Test.ZIP", "C:\Temp\aaa")
? lcZip
*!* ******************************************
*!* 功 能:解压缩单个文件。
*!* 函数名:UnZip(cZipFileName, cDestination)
*!* 返回值:逻辑值,压缩成功,返回真。
*!* 参 数:cZipFileName:字符型,待解压的Zip文件名
*!* cDestination:字符型,在zip中要解压的文件名
*!* 类 型:字符型。
*!* 默认值:无。
*!* 示 例:lcUnZip = UnZip("C:\Test.ZIP", "C:\Temp\") && 解压缩C:\Test.ZIP所有文件所到C:\temp\
*!* ******************************************
Function UnZip(cZipFileName As String, cDestination As String)
lcRet = ""
If Parameters() <> 2
lcRet = "参数错误."
Else
oShell = Createobject("Shell.Application")
For Each oFile In oShell.NameSpace(cZipFileName).Items
oShell.NameSpace(cDestination).CopyHere(oFile)
Endfor
Endif
lcRet = "解压缩正确."
oShell = .Null.
Return lcRet
Endfunc
Clear
lcZip = UnZip("C:\Test.ZIP", "C:\Temp\aaa")
? lcZip
*!* ******************************************
*!* 功 能:解压缩单个文件。
*!* 函数名:UnZip(cZipFileName, cDestination)
*!* 返回值:逻辑值,压缩成功,返回真。
*!* 参 数:cZipFileName:字符型,待解压的Zip文件名
*!* cDestination:字符型,在zip中要解压的文件名
*!* 类 型:字符型。
*!* 默认值:无。
*!* 示 例:lcUnZip = UnZip("C:\Test.ZIP", "C:\Temp\") && 解压缩C:\Test.ZIP所有文件所到C:\temp\
*!* ******************************************
Function UnZip(cZipFileName As String, cDestination As String)
lcRet = ""
If Parameters() <> 2
lcRet = "参数错误."
Else
oShell = Createobject("Shell.Application")
For Each oFile In oShell.NameSpace(cZipFileName).Items
oShell.NameSpace(cDestination).CopyHere(oFile)
Endfor
Endif
lcRet = "解压缩正确."
oShell = .Null.
Return lcRet
Endfunc
谢谢! 收下了。
只求每天有一丁点儿的进步就可以了