Here are some easy-to-use functions for zipping up a directory and unzipping usingPowershell. The functions use the opensource SharpZipLib library, a Zip, GZip, Tar and BZip2 library written entirely in C# for the .NET platform. So you'll need to download this and reference the SharpZipLib assembly in the appropriate place in the functions below.
function ZipFiles($sourcePath,$zipFilename) { # Reference the SharpZipLib assembly here [System.Reflection.Assembly]::LoadFrom("C:\ICSharpCode.SharpZipLib.dll") $zip = New-Object ICSharpCode.SharpZipLib.Zip.FastZip $zip.CreateZip($zipFilename,$sourcePath, $true,"") } function UnzipFiles($zipFilename,$destinationPath) { # Reference the SharpZipLib assembly here [System.Reflection.Assembly]::LoadFrom("C:\ICSharpCode.SharpZipLib.dll") $zip = New-Object ICSharpCode.SharpZipLib.Zip.FastZip $zip.ExtractZip($zipFilename,$destinationPath,"") } 我去!!!!!!发上去5分钟,TMD被踩了三次,大神能不能提出点高明的意见啊???!!! 光踩不发表意见怎么共同进步啊? 怎么显出你大神啊? 踩的很爽吧??!!! 附上SharpZipLib_0860_Bin.zip