external help file | Module Name | online version | schema |
---|---|---|---|
PSCompression-help.xml |
PSCompression |
2.0.0 |
Expands a Gzip compressed file from a specified File Path or Paths.
Expand-GzipArchive
-Path <String[]>
[-Raw]
[<CommonParameters>]
Expand-GzipArchive
-Path <String[]>
-Destination <String>
[-Encoding <Encoding>]
[-PassThru]
[-Force]
[-Update]
[<CommonParameters>]
Expand-GzipArchive
-LiteralPath <String[]>
[-Raw]
[<CommonParameters>]
Expand-GzipArchive
-LiteralPath <String[]>
-Destination <String>
[-Encoding <Encoding>]
[-PassThru]
[-Force]
[-Update]
[<CommonParameters>]
The Expand-GzipArchive
cmdlet aims to expand Gzip compressed files to a destination path or to the success stream using the GzipStream
Class. This cmdlet is the counterpart of Compress-GzipArchive
.
PS ..\pwsh> Expand-GzipArchive .\files\file.gz
hello world!
Output goes to the Success Stream when -Destination
is not used.
PS ..\pwsh> Expand-GzipArchive .\files\file.gz -Destination .\files\file.txt
# Checking Length Difference
PS ..\pwsh> Get-Item -Path .\files\file.gz, .\files\file.txt |
Select-Object Name, Length
Name Length
---- ------
file.gz 3168
file.txt 6857
PS ..\pwsh> Expand-GzipArchive *.gz -Destination .\files\file.txt -Update
PS ..\pwsh> Expand-GzipArchive *.gz -Destination .\files\file.txt -Force
Specifies the path or paths to the Gzip files to expand. To specify multiple paths, and include files in multiple locations, use commas to separate the paths. This Parameter accepts wildcard characters. Wildcard characters allow you to add all files in a directory to your archive file.
Type: String[]
Parameter Sets: PathDestination, Path
Aliases:
Required: True
Position: 0
Default value: None
Accept pipeline input: True (ByValue)
Accept wildcard characters: False
Specifies the path or paths to the Gzip files to expand.
Unlike the -Path
Parameter, the value of -LiteralPath
is used exactly as it's typed.
No characters are interpreted as wildcards
Type: String[]
Parameter Sets: LiteralPathDestination, LiteralPath
Aliases: PSPath
Required: True
Position: Named
Default value: None
Accept pipeline input: True (ByPropertyName)
Accept wildcard characters: False
The destination path where to expand the Gzip file. The target folder is created if it does not exist.
Note
This parameter is Optional, if not used, this cmdlet outputs to the Success Stream.
Type: String
Parameter Sets: PathDestination, LiteralPathDestination
Aliases: DestinationPath
Required: True
Position: Named
Default value: None
Accept pipeline input: False
Accept wildcard characters: False
Character encoding used when expanding the Gzip content. This parameter is only available when expanding to the Success Stream.
Note
The default encoding is utf8NoBOM
.
Type: Encoding
Parameter Sets: Path, LiteralPath
Aliases:
Required: False
Position: Named
Default value: utf8NoBOM
Accept pipeline input: False
Accept wildcard characters: False
Outputs the expanded file as a single string with newlines preserved. By default, newline characters in the expanded string are used as delimiters to separate the input into an array of strings.
Note
This parameter is only available when expanding to the Success Stream.
Type: SwitchParameter
Parameter Sets: Path, LiteralPath
Aliases:
Required: False
Position: Named
Default value: False
Accept pipeline input: False
Accept wildcard characters: False
Outputs the object representing the expanded file.
Type: SwitchParameter
Parameter Sets: PathDestination, LiteralPathDestination
Aliases:
Required: False
Position: Named
Default value: False
Accept pipeline input: False
Accept wildcard characters: False
The destination file gets overwritten if exists, otherwise created when this switch is used.
Note
If -Force
and -Update
are used together this cmdlet will append content to the destination file.
Type: SwitchParameter
Parameter Sets: PathDestination, LiteralPathDestination
Aliases:
Required: False
Position: Named
Default value: None
Accept pipeline input: False
Accept wildcard characters: False
Contents of the expanded file or files are appended to the destination path if exists, otherwise the destination is created.
Note
If -Force
and -Update
are used together this cmdlet will append content to the destination file.
Type: SwitchParameter
Parameter Sets: PathDestination, LiteralPathDestination
Aliases:
Required: False
Position: Named
Default value: None
Accept pipeline input: False
Accept wildcard characters: False
This cmdlet supports the common parameters. For more information, see about_CommonParameters.
You can pipe paths to this cmdlet. Output from Get-ChildItem
or Get-Item
can be piped to this cmdlet.
This cmdlet outputs an array of string to the success stream when -Destination
is not used and a single multi-line string when used with the -Raw
switch.
This cmdlet produces no output when expanding to a file and -PassThru
is not used.
When the -PassThru
switch is used this cmdlet outputs the FileInfo
instance representing the expanded file.