加入收藏 | 设为首页 | 会员中心 | 我要投稿 李大同 (https://www.lidatong.com.cn/)- 科技、建站、经验、云计算、5G、大数据,站长网!
当前位置: 首页 > 综合聚焦 > 服务器 > Windows > 正文

如何使用内部Windows XP选项在VBScript中解压缩文件

发布时间:2020-12-14 01:47:03 所属栏目:Windows 来源:网络整理
导读:我想使用VBScript解压缩.zip文件,只是它一直是一个没有外部应用程序的新电脑.现在我知道 Windows XP和2003有一个内部的.zip文件夹选项,所以我想我可以通过VBScript使用它来提取文件. 我该怎么做? 我试过了: Set objShell = CreateObject("Shell.Applicatio
我想使用VBScript解压缩.zip文件,只是它一直是一个没有外部应用程序的新电脑.现在我知道 Windows XP和2003有一个内部的.zip文件夹选项,所以我想我可以通过VBScript使用它来提取文件.

我该怎么做?

我试过了:

Set objShell = CreateObject("Shell.Application")

Set SrcFldr = objShell.NameSpace(fileName)
Set DestFldr = objShell.NameSpace(appDir)
DestFldr.CopyHere(SrcFldr)

哪个没有工作.
可能是什么问题呢?

只需设置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

(编辑:李大同)

【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容!

    推荐文章
      热点阅读