Skip to content

Instantly share code, notes, and snippets.

@karlgluck
Created May 14, 2022 17:46
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save karlgluck/a71dc31e70e05688a8e03227325128c9 to your computer and use it in GitHub Desktop.
Save karlgluck/a71dc31e70e05688a8e03227325128c9 to your computer and use it in GitHub Desktop.
How to extract a single file from a ZIP archive using Powershell
$ZipFilePath = ""
$FileNameInZip = ""
Add-Type -AssemblyName System.IO.Compression.FileSystem
$Zip = [System.IO.Compression.ZipFile]::OpenRead($ZipFilePath)
$Zip.Entries |
Where-Object { $_.Name -eq $FileNameInZip } |
ForEach-Object {
[System.IO.Compression.ZipFileExtensions]::ExtractToFile($_, $_.Name, $true)
}
$Zip.Dispose()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment