Unzip a file in c# using 7z.exe

前端 未结 6 991
被撕碎了的回忆
被撕碎了的回忆 2020-12-12 05:31

I\'m trying to unzip a file from a winform application. I\'m using this code :

string dezarhiverPath = @AppDomain.CurrentDomain.BaseDirectory + \"\\\\7z.exe\         


        
6条回答
  •  旧巷少年郎
    2020-12-12 06:12

    Try this

        string fileZip = @"c:\example\result.zip";
        string fileZipPathExtactx= @"c:\example\";
        ProcessStartInfo p = new ProcessStartInfo();
        p.WindowStyle = ProcessWindowStyle.Hidden;
        p.FileName = dezarhiverPath ;
        p.Arguments = "x \"" + fileZip + "\" -o" + fileZipPathExtact;
        Process x = Process.Start(p);
        x.WaitForExit();
    

提交回复
热议问题