File tree Expand file tree Collapse file tree 1 file changed +34
-0
lines changed
Expand file tree Collapse file tree 1 file changed +34
-0
lines changed Original file line number Diff line number Diff line change 1+ Add-Type - AssemblyName " System.Windows.Forms"
2+
3+ function Show-OpenFileDialog {
4+ $dialog = New-Object System.Windows.Forms.OpenFileDialog
5+ $dialog.Filter = " ZIP Archive (*.zip)|*.zip"
6+ $dialog.Title = " Select ZIP File"
7+ if ($dialog.ShowDialog () -eq " OK" ) {
8+ return $dialog.FileName
9+ }
10+ return $null
11+ }
12+
13+ function Show-FolderBrowserDialog {
14+ $dialog = New-Object System.Windows.Forms.FolderBrowserDialog
15+ $dialog.Description = " Select Destination Folder"
16+ if ($dialog.ShowDialog () -eq " OK" ) {
17+ return $dialog.SelectedPath
18+ }
19+ return $null
20+ }
21+
22+ $zipFile = Show-OpenFileDialog
23+ if (-not $zipFile ) {
24+ Write-Host " No ZIP file selected. The script will be canceled."
25+ exit
26+ }
27+
28+ $destinationFolder = Show-FolderBrowserDialog
29+ if (-not $destinationFolder ) {
30+ Write-Host " No destination folder selected. The script will be canceled."
31+ exit
32+ }
33+
34+ Expand-Archive - Path $zipFile - DestinationPath $destinationFolder
You can’t perform that action at this time.
0 commit comments