用 Expand-Archive 解压 zip 文件
从 PowerShell 解压 zip 压缩包,目标目录不存在时会自动创建。
运行 `Expand-Archive -Path file.zip -DestinationPath .\out -Force` 把压缩包解压到指定文件夹。
01命令
命令
$ Expand-Archive -Path .\project-backup.zip -DestinationPath .\restored -Force02作用说明
Expand-Archive 是 Compress-Archive 的对应解压命令,可处理任何标准 ZIP 文件。目标目录不存在时会自动创建,加 -Force 可覆盖已有文件而不报错。在没有资源管理器的 WinRE 恢复环境或 CI 脚本里,这条命令尤其方便。
03风险
04撤销
✓无需撤销——该命令不会改变持久状态。
05来源
- Expand-Archive (Microsoft.PowerShell.Archive)依据: Documents Expand-Archive with -Path, -DestinationPath and -Force to extract ZIP archives from PowerShell.
最后验证: 2026-09-17 · 分类: 文件与文件夹