Reputation: 651
$sourceZip = "Path\Bla.zip\"
$destinationForExtraction = "Anotherpath\Bla"
7z x $sourceZip "-o$destinationForExtraction" *.exe -y
This code snippets gives an error 7z : ERROR: CRC Failed: SomeFile.exe
.
I have checked the crc of the above file. Yes the crc doesn't match. But the same zip gets extracted using manual procedure (Right Click > Extract To Folder).
Is there any way to handle this exception?
What's the reason behind these contradicting behaviors of 7z? It extracts properly while extracting manually but can not extract the same file while extracting through command line.
Upvotes: 2
Views: 3215
Reputation: 9133
Redirecting the error should work for you:
$cmdOutput = 7z x $sourceZip "-o$destinationForExtraction" *.exe -y 2>&1
$cmdoutput should hold the value now.
Upvotes: 1