Extracts files from a specified archive (zipped) file.
Syntax Path (Default)Expand-Archive
[-Path] <String>
[[-DestinationPath] <String>]
[-Force]
[-PassThru]
[-WhatIf]
[-Confirm]
[<CommonParameters>]
LiteralPath
Expand-Archive
[[-DestinationPath] <String>]
-LiteralPath <String>
[-Force]
[-PassThru]
[-WhatIf]
[-Confirm]
[<CommonParameters>]
Description
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 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:\Reference
In 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:\Reference
Parameters -Confirm
Prompts you for confirmation before running the cmdlet.
Parameter properties Type: SwitchParameter Default value: False Supports wildcards: False DontShow: False Aliases: cf Parameter sets (All) Position: Named Mandatory: False Value from pipeline: False Value from pipeline by property name: False Value from remaining arguments: False -DestinationPathBy 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.
Use this parameter to overwrite existing files. By default, Expand-Archive
doesn't overwrite.
Specifies 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.
Parameter properties Type: String Default value: None Supports wildcards: False DontShow: False Aliases: PSPath Parameter sets LiteralPath Position: Named Mandatory: True Value from pipeline: False Value from pipeline by property name: True Value from remaining arguments: False -PassThruCauses the cmdlet to output a list of the files expanded from the archive.
Parameter properties Type: SwitchParameter Default value: None Supports wildcards: False DontShow: False Parameter sets (All) Position: Named Mandatory: False Value from pipeline: False Value from pipeline by property name: False Value from remaining arguments: False -PathSpecifies the path to the archive file.
Parameter properties Type: String Default value: None Supports wildcards: False DontShow: False Parameter sets Path Position: 0 Mandatory: True Value from pipeline: True Value from pipeline by property name: True Value from remaining arguments: False -WhatIfShows what would happen if the cmdlet runs. The cmdlet isn't run.
Parameter properties Type: SwitchParameter Default value: False Supports wildcards: False DontShow: False Aliases: wi Parameter sets (All) Position: Named Mandatory: False Value from pipeline: False Value from pipeline by property name: False Value from remaining arguments: False CommonParametersThis cmdlet supports the common parameters: -Debug, -ErrorAction, -ErrorVariable, -InformationAction, -InformationVariable, -OutBuffer, -OutVariable, -PipelineVariable, -ProgressAction, -Verbose, -WarningAction, and -WarningVariable. For more information, see about_CommonParameters.
Inputs StringYou can pipe a string that contains a path to an existing archive file.
Outputs NoneBy default, this cmdlet returns no output.
FileSystemInfoWhen you use the PassThru parameter, this cmdlet returns a list of files that were expanded from the archive.
NotesThe 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.
RetroSearch is an open source project built by @garambo | Open a GitHub Issue
Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo
HTML:
3.2
| Encoding:
UTF-8
| Version:
0.7.4