Vb.net 在vb中解压缩文件
当我尝试解压文件时,会出现异常 当我删除try时,我收到: 其他信息:对象引用未设置为对象的实例 我已尝试将output.CopyHere(input.Items,4)设置为output.CopyHere(input.Items,148),但返回相同的错误Vb.net 在vb中解压缩文件,vb.net,unzip,shell32,Vb.net,Unzip,Shell32,当我尝试解压文件时,会出现异常 当我删除try时,我收到: 其他信息:对象引用未设置为对象的实例 我已尝试将output.CopyHere(input.Items,4)设置为output.CopyHere(input.Items,148),但返回相同的错误 (148是zip中的项目数)如果输入或输出文件夹的路径无效,将导致此错误。在dim语句中使用路径之前,请检查路径。您需要从理解错误消息开始。一旦你明白了这一点,你就会处于一个更好的位置。错误消息确实有其目的和意义。由于某些原因,可能重复“好的
(148是zip中的项目数)如果输入或输出文件夹的路径无效,将导致此错误。在dim语句中使用路径之前,请检查路径。您需要从理解错误消息开始。一旦你明白了这一点,你就会处于一个更好的位置。错误消息确实有其目的和意义。由于某些原因,可能重复“好的”是“路径错误”。我想前斜杠可以用,但我改成了后斜杠,效果100%。我不知道这有什么关系,因为我以前用过前斜杠。
Try
Dim sc As New Shell32.Shell()
'
'Create directory in which you will unzip your files .
'
IO.Directory.CreateDirectory(Application.StartupPath & "/Packs/SkyNet/mods")
'
'Declare the folder where the files will be extracted
'
Dim output As Shell32.Folder = sc.NameSpace(Application.StartupPath & "/Packs/SkyNet/mods")
'
'Declare your input zip file as folder .
'
Dim input As Shell32.Folder = sc.NameSpace(Application.StartupPath & "/Downloads/SkyNet.zip")
'
'Extract the files from the zip file using the CopyHere command .
'
output.CopyHere(input.Items, 4)
My.Computer.FileSystem.WriteAllText(Application.StartupPath & "/Config/SkyNet.pack", "SkyNet Installed", False)
Catch ex As Exception
MessageBox.Show("Could Not Extract Pack: SkyNet", "SkyNet Launcher: Error", MessageBoxButtons.OK, MessageBoxIcon.Error)
My.Computer.FileSystem.WriteAllText(Application.StartupPath & "/Config/SkyNet.pack", "SkyNet Not Installed", False)
End Try