减压Zip与创建Zip文档

Posted on 2019-05-21 19:48  努力成长静待花开  阅读(266)  评论(0编辑  收藏  举报

压缩文档:

  

关于压缩等级:

Fastest 使用最快的压缩方法来减少处理时间;这可能会导致更大的文件大小。
NoCompression 不要压缩源文件。
Optimal 处理时间取决于文件大小。

#压缩级别设为最佳
Compress-Archive -Path .\temp\* -DestinationPath .\Compress_temp.zip -CompressionLevel Optimal
#更新之前的压缩文件
Compress-Archive -Path .\temp\* -DestinationPath .\Compress_temp.zip -CompressionLevel Optimal -Update
#也可以省略.zip后缀
Compress-Archive -Path .\temp\* -DestinationPath .\Compress -CompressionLevel Optimal

 减压文档:

Expand-Archive -LiteralPath C:\Compress.zip -DestinationPath c:\Temp_2
Expand-Archive -Path .\Compress_temp.zip -DestinationPath temp_3