PowerShell snippet:
Import-Module Pscx
Expand-Archive ConsoleApplication1.zip ./
Write-Host $?
Write-Host $LastExitCode
Neither $?
nor $LastExitCode
report about error. But there is error, because file ConsoleApplication1.exe is locked (i started this app). I can see failure by following output:
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)
...
Question: how can I detect in powershell that Expand-Archive failed
Thanks