$Title = "PowerShell ZIP Extractor" $Info = "Standard or Recursive Extraction? Recursive And Move will copy all extracted data to same location as this file." $Standard = New-Object System.Management.Automation.Host.ChoiceDescription '&Standard', 'Unzip all ZIP files in the same location as this file.' $Recursive = New-Object System.Management.Automation.Host.ChoiceDescription '&Recursive', 'Unzip all ZIP files recursively. Keeping the data in their respective folders.' $MoveRecursive = New-Object System.Management.Automation.Host.ChoiceDescription 'Recursive And &Move', 'Extract all data to the same location as this file.' $Cancel = New-Object System.Management.Automation.Host.ChoiceDescription '&Cancel', 'Cancel and close.' $options = [System.Management.Automation.Host.ChoiceDescription[]] @($Standard, $Recursive, $MoveRecursive, $Cancel) [int]$defaultchoice = 2 $opt = $host.UI.PromptForChoice($Title , $Info , $Options,$defaultchoice) switch($opt) { 0 { $ZipFileList = Get-ChildItem -Path $PSScriptRoot\*.zip; foreach ($ZipFile in $ZipFileList) { Expand-Archive -Path $ZipFile.FullName -DestinationPath $ZipFile.Directory -Force;}} 1 {$ZipFileList = Get-ChildItem -Path $PSScriptRoot\*.zip -Recurse; foreach ($ZipFile in $ZipFileList) { Expand-Archive -Path $ZipFile.FullName -DestinationPath $ZipFile.Directory -Force;}} 2 {$ZipFileList = Get-ChildItem -Path $PSScriptRoot\*.zip -Recurse; foreach ($ZipFile in $ZipFileList) { Expand-Archive -Path $ZipFile.FullName -DestinationPath $PSScriptRoot -Force;}} }