Advertisement
jeffharbert

Extract Zip Files with Powershell

Feb 9th, 2017
214
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. ##  Place this script inside the folder that contains your ZIP files and run it from there.
  2. Add-Type -AssemblyName System.IO.Compression.FileSystem
  3. function Unzip
  4.     {
  5.         param([string]$zipfile, [string]$outpath)
  6.         [System.IO.Compression.ZipFile]::ExtractToDirectory($zipfile, $outpath)
  7.     }
  8.  
  9. ##  Uncomment the specific line you need. Edit the file paths to meet your requirements. NOTE: Files that already exist in the destination folder will be overwritten without warning.
  10.  
  11. ##  Use this line to unzip a specific ZIP file.
  12. #Unzip "C:\path\to\ZIP_file.zip" "C:\path\to\destination\folder\"
  13.  
  14. ##  Use this line to unzip all ZIP files in a folder to the same destination.
  15. #Get-Childitem | where {$_.extension -eq ".zip" | % {Unzip $_.FullName "C:\path\to\destination\folder\"}
  16.  
  17. ##  Use this line to unzip all ZIP files in a folder and all subfolders to the same destination.
  18. #Get-Childitem -recurse | where {$_.extension -eq ".zip" | % {Unzip $_.FullName "C:\path\to\destination\folder\"}
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement