[英]How to unzip a file in VBScript using internal Windows XP options in
I want to unzip a .zip file using VBScript, only it's always a new computer with no external applications on it. 我想使用VBScript解压缩.zip文件,只是它始终是一台没有外部应用程序的新计算机。 Now I know Windows XP and 2003 have an internal .zip folder option, so I guess I can use it via VBScript in order to extract the file.
现在我知道Windows XP和2003有一个内部.zip文件夹选项,所以我想我可以通过VBScript使用它来提取文件。
How do I do it? 我该怎么做?
I tried: 我试过了:
Set objShell = CreateObject("Shell.Application")
Set SrcFldr = objShell.NameSpace(fileName)
Set DestFldr = objShell.NameSpace(appDir)
DestFldr.CopyHere(SrcFldr)
Which didn't work. 哪个没有用。 What could be the problem?
可能是什么问题呢?
Just set ZipFile = The location of the zip file, and ExtractTo = to the location the zip file should be extracted to. 只需设置ZipFile = zip文件的位置,并将ExtractTo =设置为应将zip文件提取到的位置。
'The location of the zip file.
ZipFile="C:\Test.Zip"
'The folder the contents should be extracted to.
ExtractTo="C:\Test\"
'If the extraction location does not exist create it.
Set fso = CreateObject("Scripting.FileSystemObject")
If NOT fso.FolderExists(ExtractTo) Then
fso.CreateFolder(ExtractTo)
End If
'Extract the contants of the zip file.
set objShell = CreateObject("Shell.Application")
set FilesInZip=objShell.NameSpace(ZipFile).items
objShell.NameSpace(ExtractTo).CopyHere(FilesInZip)
Set fso = Nothing
Set objShell = Nothing
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.