Skip to content

Instantly share code, notes, and snippets.

@serbrech
Last active June 2, 2016 19:01
Show Gist options
  • Save serbrech/270c82fd516e60fb5800e5bb24ee1908 to your computer and use it in GitHub Desktop.
Save serbrech/270c82fd516e60fb5800e5bb24ee1908 to your computer and use it in GitHub Desktop.
#FAILS
class Test {
[void] static Foo($zipfile) {
Add-Type -AssemblyName System.IO.Compression.FileSystem
$ziparchive = [System.IO.Compression.ZipFile]::OpenRead($zipfile) #fails at runtime, and ISE puts squiggly lines under System.IO.Compression.ZipFile
$ziparchive.Entries | % { Write-Host $_.Name }
}
}
#WORKS
Function ListZip {
param(
[string]$zipfile
)
Add-Type -AssemblyName System.IO.Compression.FileSystem
$ziparchive = [System.IO.Compression.ZipFile]::OpenRead($zipfile)
$ziparchive.Entries | % { Write-Host $_.Name }
}
@serbrech
Copy link
Author

serbrech commented Jun 2, 2016

Nevermind... that works

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment