这里是xp下测试好用的vbs解压缩函数.使用时,只需要将函数写入临时vbs文件,调用cmd运行cscript temp.vbs即可,运行完了删除vbs文件就行.
UnZip "C:\Test\t\test.zip","C:\Test\t\test"
Msgbox "OK"
Sub UnZip(ByVal myZipFile, ByVal myTargetDir)
Set fso = CreateObject("Scripting.FileSystemObject")
If NOT fso.FileExists(myZipFile) Then
Exit Sub
ElseIf fso.GetExtensionName(myZipFile) <> "zip" Then
Exit Sub
ElseIf NOT fso.FolderExists(myTargetDir) Then
fso.CreateFolder(myTargetDir)
End If
Set objShell = CreateObject("Shell.Application")
Set objSource = objShell.NameSpace(myZipFile)
Set objFolderItem = objSource.Items()
Set objTarget = objShell.NameSpace(myTargetDir)
intOptions = 256
objTarget.CopyHere objFolderItem, intOptions
End Sub
No comments :
Post a Comment