| external help file | Microsoft.PowerShell.Archive-help.xml |
|---|---|
| Locale | en-US |
| Module Name | Microsoft.PowerShell.Archive |
| ms.date | 04/01/2026 |
| online version | https://learn.microsoft.com/powershell/module/microsoft.powershell.archive/expand-archive?view=powershell-5.1&WT.mc_id=ps-gethelp |
| schema | 2.0.0 |
| title | Expand-Archive |
Extracts files from a specified ZIP archive file.
Expand-Archive [-Path] <String> [[-DestinationPath] <String>] [-Force] [-WhatIf]
[-Confirm] [<CommonParameters>]
Expand-Archive -LiteralPath <String> [[-DestinationPath] <String>] [-Force] [-WhatIf]
[-Confirm] [<CommonParameters>]
The Expand-Archive cmdlet extracts files from a specified zipped archive file to a specified
destination folder. An archive file allows multiple files to be packaged, and optionally compressed,
into a single zipped file for easier distribution and storage.
This cmdlet only works with zip archives, which typically have the file extension .zip.
The Expand-Archive cmdlet uses the System.IO.Compression.ZipArchive API to compress files.
The API limits the maximum file size to 2GB. The .NET API works with files that conform to the
official ZIP file format specification by PKWARE Inc. For more information, see
System.IO.Compression.ZipArchive.
This example extracts the contents of an existing archive file into the folder specified by the DestinationPath parameter.
Expand-Archive -LiteralPath 'C:\Archives\Draft[v1].zip' -DestinationPath C:\ReferenceIn this example, the LiteralPath parameter is used because the filename contains characters that could be interpreted as wildcards.
This example extracts the contents of an existing archive file in the current folder into the folder specified by the DestinationPath parameter.
Expand-Archive -Path Draftv2.zip -DestinationPath C:\ReferenceBy default, Expand-Archive creates a folder in the current location that's the same name as the
ZIP file. The parameter allows you to specify the path to a different folder. The target folder is
created if it doesn't exist.
Type: System.String
Parameter Sets: (All)
Aliases:
Required: False
Position: 1
Default value: A folder in the current location
Accept pipeline input: False
Accept wildcard characters: FalseUse this parameter to overwrite existing files. By default, Expand-Archive doesn't overwrite.
Type: System.Management.Automation.SwitchParameter
Parameter Sets: (All)
Aliases:
Required: False
Position: Named
Default value: None
Accept pipeline input: False
Accept wildcard characters: FalseSpecifies the path to an archive file. Unlike the Path parameter, the value of LiteralPath is used exactly as it's typed. Wildcard characters aren't supported. If the path includes escape characters, enclose each escape character in single quotation marks, to instruct PowerShell not to interpret any characters as escape sequences.
Type: System.String
Parameter Sets: LiteralPath
Aliases: PSPath
Required: True
Position: Named
Default value: None
Accept pipeline input: True (ByPropertyName)
Accept wildcard characters: FalseSpecifies the path to the archive file.
Type: System.String
Parameter Sets: Path
Aliases:
Required: True
Position: 0
Default value: None
Accept pipeline input: True (ByPropertyName, ByValue)
Accept wildcard characters: FalsePrompts you for confirmation before running the cmdlet.
Type: System.Management.Automation.SwitchParameter
Parameter Sets: (All)
Aliases: cf
Required: False
Position: Named
Default value: False
Accept pipeline input: False
Accept wildcard characters: FalseShows what would happen if the cmdlet runs. The cmdlet isn't run.
Type: System.Management.Automation.SwitchParameter
Parameter Sets: (All)
Aliases: wi
Required: False
Position: Named
Default value: False
Accept pipeline input: False
Accept wildcard characters: FalseThis cmdlet supports the common parameters: -Debug, -ErrorAction, -ErrorVariable, -InformationAction, -InformationVariable, -OutVariable, -OutBuffer, -PipelineVariable, -Verbose, -WarningAction, and -WarningVariable. For more information, see about_CommonParameters.
You can pipe a string that contains a path to an existing archive file.
The Compress-Archive cmdlet uses UTF-8 encoding. Other ZIP archive tools may use a different
encoding scheme. When extracting files with filenames not stored using UTF-8 encoding,
Expand-Archive uses the raw value found in the archive. This can result in a filename that's
different than the source filename stored in the archive.