Expand-Archive
Use Expand-Archive to extract the contents of a zip archive to a folder.
Documentation: Microsoft Learn — PowerShell module reference
Syntax
See the command anatomy
Read the command and its supplied arguments. This example requires real PowerShell or its module; this diagram does not execute it.
Expand-Archive [-Path] <String> [[-DestinationPath] <string>] [-Force] [-PassThru] [<CommonParameters>]- Stage 1Expand-Archive
-Path -DestinationPath -Force -PassThru
Try it
PowerShell example · browser support is limited.
Execution scope: The full example below requires PowerShell outside this browser. You can edit this runner to use the supported practice commands; unsupported syntax returns an explanation.
Follow the objects
Run the command to inspect each stage.
Examples
Expand-Archive -Path 'C:\Temp\scripts.zip'
Show reference output
Sample output · fictional data, shaped like the real thing
Directory: C:\Temp\extracted Mode LastWriteTime Length Name ---- ------------- ------ ---- -a---- 10/9/2026 2:22 PM 2418 Backup-Files.ps1 -a---- 10/9/2026 2:22 PM 1876 Deploy-App.ps1 -a---- 10/9/2026 2:22 PM 954 New-UserReport.ps1
Expand-Archive -Path 'C:\Temp\scripts.zip' (2)
Show reference output
Sample output · fictional data, shaped like the real thing
Directory: C:\Temp\extracted Mode LastWriteTime Length Name ---- ------------- ------ ---- d----- 10/9/2026 2:23 PM Modules -a---- 10/9/2026 2:23 PM 2418 Backup-Files.ps1 -a---- 10/9/2026 2:23 PM 1876 Deploy-App.ps1
Parameters
Parameter definitions:
-Path-DestinationPath-Force-PassThru
Practical use and troubleshooting
Practical scenario: Use Expand-Archive when you need to extract the contents of a zip archive to a folder. Review syntax and sample output, then try an example in the browser lab. Start with one identified target and inspect the returned values before extending the operation to a list. Keep the identity in your report so you can trace each result back to the object or path that produced it.
Common error and fix: Existing destination files can prevent extraction. Extract into a new empty directory or use -Force only when replacing those files is intended; inspect the resulting directory afterwards. In an unattended script, capture this failure with its original error record and record which target failed. An empty result and an unsuccessful query must remain distinguishable in the final report.
See also: Compress-Archive. Compress-Archive writes a ZIP archive; Expand-Archive extracts one. Confirm the source set before compression and the destination before extraction. Read the linked command before substituting it; similar names do not imply identical inputs or output.
Recap
Expand-Archive Use Expand-Archive to extract the contents of a zip archive to a folder.
Next: Compress-Archive