存档 cmdletArchive cmdlets

两个新的 cmdlet Compress-ArchiveExpand-Archive 可用于压缩和展开 ZIP 文档。Two new cmdlets, Compress-Archive and Expand-Archive, let you compress and expand ZIP files.

Compress-ArchiveCompress-Archive

Compress-Archive cmdlet 从指定文件创建新存档文件。The Compress-Archive cmdlet creates a new archive file from specified files. 存档文件允许将多个文件打包,还可选择性地将其压缩为单个文件以便处理和存储。An archive file allows multiple files to be packaged and optionally compressed into a single file for easier handling and storage. 可以使用 -CompressionLevel 参数中指定的压缩算法来压缩存档文件。An archive file can be compressed by using a compression algorithm specified in the -CompressionLevel parameter.

Compress-Archive -LiteralPath <String[]> [-DestinationPath] <String> [-Update] [-CompressionLevel <Microsoft.PowerShell.Commands.CompressionLevel>]
Compress-Archive [-Path] <String[]> [-DestinationPath] <String> [-Update] [-CompressionLevel <Microsoft.PowerShell.Commands.CompressionLevel>]

Expand-ArchiveExpand-Archive

Expand-Archive cmdlet 从指定存档文件提取文件。The Expand-Archive cmdlet extracts files from a specified archive file. 存档文件允许将多个文件打包,还可选择性地将其压缩为单个文件以便处理和存储。An archive file allows multiple files to be packaged and optionally compressed into a single file for easier handling and storage.

Expand-Archive -LiteralPath <String> [-DestinationPath] <String>
Expand-Archive [-Path] <String> [-DestinationPath] <String>