【发布时间】:2019-07-30 01:09:53
【问题描述】:
我有一个脚本,其中包括:
try {
Compress-Archive -Path "$($folder.FullName)\*" -CompressionLevel Optimal -DestinationPath $FullPath -Force
} catch {
Write-Output "`nFailed to create zip"
}
-Path 文件夹中的某些文件已被其他用户打开,因此 Compress-Archive 无法将它们添加到 zip。它会将此失败报告给 stderr,但不会引发错误。
有没有什么方法可以确定该命令仅部分成功而无需解析 stderr 或重新打开 zip 并比较内容?
【问题讨论】:
标签: powershell