【发布时间】:2011-02-10 05:04:59
【问题描述】:
PowerShell sn-p:
Import-Module Pscx
Expand-Archive ConsoleApplication1.zip ./
Write-Host $?
Write-Host $LastExitCode
$? 和 $LastExitCode 都不会报告错误。但是有错误,因为文件 ConsoleApplication1.exe 被锁定(我启动了这个应用程序)。我可以通过以下输出看到失败:
WARNING: ArchiveCallBack->GetStream error: System.IO.IOException:
The process cannot access the file 'D:\tmp\ConsoleApplication1.exe'
because it is being used by another process.
at System.IO.__Error.WinIOError(Int32 errorCode, String maybeFullPath)
...
问题:如何在 powershell 中检测 Expand-Archive 失败
谢谢
【问题讨论】:
-
嗨 Roman - 请在 pscx.codeplex.com 上记录一个错误,我会在下一个版本 - Oisin 修复这个问题。
-
嗨,奥辛。完成:pscx.codeplex.com/workitem/30139
标签: powershell error-handling pscx