Expand-Archive
Unzip a file
Expand-Archive -Path .\docs.zip -DestinationPath .\docs-unzipped
- Works on
- WindowsLinuxmacOS
- PowerShell
- 5.1 and later
- Reference
- Microsoft Learn: Expand-Archive
Extracts every file in a zip into the destination folder. The folder is created if it does not exist.
If a file is already there, the command stops with an error. Add -Force to overwrite.
Downloaded zips carry the "from the internet" mark, and so do the files inside them. If a script from the zip will not run, see Unblock-File.
Try this
Expand-Archive -Path .\docs.zip -DestinationPath .\docs-unzipped -Force
Get-ChildItem -Path .\docs-unzipped -Recurse
Coming from another shell
| Shell | What you might type |
|---|---|
| bash / zsh | unzip docs.zip -d docs-unzipped |
| cmd.exe | tar -x -f docs.zip -C docs-unzipped |
More in From bash and From cmd.