powershell - 如何使用 PowerShell 创建 zip 存档?

标签 powershell zip archive

是否可以使用 PowerShell 创建 zip 存档?

最佳答案

PowerShell v5.0 添加 Compress-ArchiveExpand-Archive cmdlet。链接的页面有完整的示例,但其要点是:

# Create a zip file with the contents of C:\Stuff\
Compress-Archive -Path C:\Stuff -DestinationPath archive.zip

# Add more files to the zip file
# (Existing files in the zip file with the same name are replaced)
Compress-Archive -Path C:\OtherStuff\*.txt -Update -DestinationPath archive.zip

# Extract the zip file to C:\Destination\
Expand-Archive -Path archive.zip -DestinationPath C:\Destination

关于powershell - 如何使用 PowerShell 创建 zip 存档?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/1153126/

相关文章:

powershell - 如何获取在 Azure Function 中运行的 Azure PowerShell 模块版本列表?

powershell - 在 PowerShell 中终止脚本

c - 如何使用 zlib 制作 .zip 文件

javascript - 使用 JavaScript 传输大文件客户端

linux - Unix 解压 : how to batch unzip zip files in a folder and save in subfolders?

python - 使用 python+django 解压缩/解压缩文件

html - 您如何将整个网站存档以供离线查看?

azure - 连接-AzureAD : parsing_wstrust_response_failed: Parsing WS-Trust response failed

.net - 在SQL Server中还原数据库失败

ios - 尝试存档项目时 Xcode 出错 : Unexpected duplicate tasks