gpt4 book ai didi

vb.net - 在 VB.net 中解压文件

转载 作者:行者123 更新时间:2023-12-01 06:54:53 25 4
gpt4 key购买 nike

很难说出这里问的是什么。这个问题模棱两可、含糊不清、不完整、过于宽泛或言辞激烈,无法以目前的形式合理回答。如需帮助澄清此问题以便可以重新打开,visit the help center .




9年前关闭。




有人可以帮助我如何解压 VB.Net 中的 zip 文件?

我正在使用“导入 Shell32”

最佳答案

如果你看看这个 CodeProject文章它应该帮助你。如果您遇到特定问题,则需要将代码和问题描述放在您的问题中。

从上面的文章:

Sub UnZip()
Dim sc As New Shell32.Shell()
'Create directory in which you will unzip your files .
IO.Directory.CreateDirectory("D:\extractedFiles")
'Declare the folder where the files will be extracted
Dim output As Shell32.Folder = sc.NameSpace("D:\extractedFiles")
'Declare your input zip file as folder .
Dim input As Shell32.Folder = sc.NameSpace("d:\myzip.zip")
'Extract the files from the zip file using the CopyHere command .
output.CopyHere(input.Items, 4)

End Sub

Folder.CopyHere 的链接方法

或者,如果您使用 .Net 4.5,您可以使用 ZipFile Class

来自链接的示例:
Imports System.IO
Imports System.IO.Compression

Module Module1

Sub Main()
Dim startPath As String = "c:\example\start"
Dim zipPath As String = "c:\example\result.zip"
Dim extractPath As String = "c:\example\extract"

ZipFile.CreateFromDirectory(startPath, zipPath)

ZipFile.ExtractToDirectory(zipPath, extractPath)
End Sub

End Module

关于vb.net - 在 VB.net 中解压文件,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/12889044/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com