expand-zip.ps1 576 B

1234567891011121314151617
  1. Function Expand-ZIP([string]$filename) {
  2. #Extract archive
  3. if ($PSVersionTable.PSVersion.Major -ge 5) {
  4. Expand-Archive $filename -DestinationPath .
  5. }
  6. elseif ( [System.Reflection.Assembly]::LoadWithPartialName("System.IO.Compression.FileSystem") ) {
  7. $path = Get-Location
  8. [System.IO.Compression.ZipFile]::ExtractToDirectory("$path\$filename",$path)
  9. }
  10. else {
  11. #Check if 7zip is installed and install it if needed
  12. . .\resources\install-7zip.ps1
  13. Install-7zip
  14. #Extract all files
  15. Start-Process "c:\Program Files\7-Zip\7z.exe" "e -y $filename"
  16. }
  17. }