简体   繁体   English

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

[英]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.

相关问题 是否可以在Windows XP上使用.BAT命令解压缩.ZIP文件? - Is it possible to unzip .ZIP file using .BAT command on Windows XP? 如何使用 git bash (Windows) 解压缩文件? - How to unzip a file using git bash (Windows)? 如何使用puppet脚本在Windows中解压缩zip文件 - How can I unzip a zip file in windows using puppet script VBScript 使用选项重命名 Windows 计算机 - VBScript Renaming Windows Computer with Options 如何在Windows XP上将日期附加到批处理文件 - How to append date to batch file on Windows XP 如何提取Windows XP扩展文件信息? - How to extract Windows XP Extended File Information? 如何在Windows中使用cmd将war文件解压缩到新文件夹(或其他驱动器)中 - How to unzip war file into the new folder(or to the another drive) using cmd in windows 如何检查网页是否已加载或我在VBScript中的XP和Windows 7和10 Internet Explorer有错误 - How to check if web page is loaded or i have error for XP and windows 7 and 10 Internet explorer in VBScript 如何使用 Windows 批处理脚本迭代和解压缩输入 txt 文件中存在的文件列表 - How to iterate and unzip list of files present in a input txt file using windows batch script 如何使用VBScript强制重启Windows框? - How to force restart a Windows box using VBScript?
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM