Share vb.net 7zip extract

vansonkkkkk

New member
Các tệp ing từ kho lưu trữ 7ZIP trong vb.net là một nhiệm vụ tương đối đơn giản.Mã sau đây sẽ trích xuất tất cả các tệp từ kho lưu trữ 7ZIP vào thư mục được chỉ định:

`` `VBNet
Nhập khẩu Sevenzip.compression.lzma

Lớp công khai Mẫu1

Nút công khai
'Nhận đường dẫn đến kho lưu trữ 7ZIP.
Dim ArchivePath AS String = "C: \ My Mysuments \ myfile.7z"

'Tạo một đối tượng lưu trữ 7ZIP mới.
Dim Archive As Sevenzip.compression.Archive = Sevenzip.compression.archive.open (ArchivePath)

'Nhận danh sách các tệp trong kho lưu trữ.
Các tệp Dim dưới dạng Sevenzip.compression.ArchiveEntryCollection = Archive.entries

'Vòng lặp qua các tệp trong kho lưu trữ và trích xuất chúng vào một thư mục được chỉ định.
Đối với mỗi tệp dưới dạng Sevenzip.compression.ArchiveEntry trong các tệp
'Nhận đường dẫn đến tệp trong kho lưu trữ.
Dim EntryPath As String = File.FullName

'Nhận đường dẫn đến tệp trên đĩa.
Dim OutputPath As String = path.combine (thư mục.getCienDirectory (), EntryPath)

'Trích xuất tệp vào đĩa.
file.extract (OutputPath)
Kế tiếp
Kết thúc phụ
Kết thúc lớp học
`` `

Để biết thêm thông tin về trích xuất các tệp từ kho lưu trữ 7ZIP trong vb.net, vui lòng xem các tài nguyên sau:

* [Tài liệu Sevenzip.net] (https://sevenzip.net/sdk/docs/)
* [Stack Overflow: Cách trích xuất các tệp từ kho lưu trữ 7ZIP trong VB.NET] (https://stackoverflow.com/questions/1184833/how-to-extract-friles-from-a-7zip-archive-in-vb-mạng lưới)

## hashtags

* #7zip
* #vb.net
* #Nén
* Khai thác #file
* #Programming
=======================================
ing files from a 7zip archive in VB.NET is a relatively simple task. The following code will extract all files from a 7zip archive to a specified directory:

```vbnet
Imports SevenZip.Compression.LZMA

Public Class Form1

Public Sub Button1_Click(sender As Object, e As EventArgs) Handles Button1.Click
' Get the path to the 7zip archive.
Dim archivePath As String = "C:\My Documents\MyFile.7z"

' Create a new 7zip archive object.
Dim archive As SevenZip.Compression.Archive = SevenZip.Compression.Archive.Open(archivePath)

' Get the list of files in the archive.
Dim files As SevenZip.Compression.ArchiveEntryCollection = archive.Entries

' Loop through the files in the archive and extract them to a specified directory.
For Each file As SevenZip.Compression.ArchiveEntry In files
' Get the path to the file in the archive.
Dim entryPath As String = file.FullName

' Get the path to the file on disk.
Dim outputPath As String = Path.Combine(Directory.GetCurrentDirectory(), entryPath)

' Extract the file to disk.
file.Extract(outputPath)
Next
End Sub
End Class
```

For more information on extracting files from a 7zip archive in VB.NET, please see the following resources:

* [SevenZip.NET Documentation](https://sevenzip.net/sdk/docs/)
* [Stack Overflow: How to extract files from a 7zip archive in VB.NET](https://stackoverflow.com/questions/1184833/how-to-extract-files-from-a-7zip-archive-in-vb-net)

## Hashtags

* #7zip
* #vb.net
* #compression
* #file extraction
* #Programming
 
Join Telegram ToolsKiemTrieuDoGroup
Back
Top