Cmdlets

Choose a cmdlet from the list on the left or search for a specific cmdlet. Choose a cmdlet from the list or search for a specific cmdlet.
About Help  Providers
 

Expand-Archive

Expand-Archive

pscx.dll, microsoft.powershell.archive.psm1

Synopsis

PSCX Cmdlet: Expands a compressed archive file, or ArchiveEntry object, to its constituent file(s).

Syntax

Expand-Archive [-LiteralPath] [-OutputPath] [-EntryPath] [-FlattenPaths] [-Force] [-Index] [-PassThru] [-Password] [-ShowProgress] [<CommonParameters>]

Expand-Archive [-Path] [-EntryPath] [-FlattenPaths] [-Force] [-Index] [-PassThru] [-Password] [-ShowProgress] [<CommonParameters>]

Expand-Archive [-InputObject] [-EntryPath] [-FlattenPaths] [-Force] [-Index] [-PassThru] [-Password] [-ShowProgress] [<CommonParameters>]

Detailed Description

Expands a compressed archive file, or ArchiveEntry object, to its constituent file(s).

Parameters

-LiteralPath <String[]>

Specifies a path to the item. The value of -LiteralPath is used exactly as it is typed. No characters are interpreted as wildcards. If the path includes escape characters, enclose it in single quotation marks. Single quotation marks tell Windows PowerShell not to interpret any characters as escape sequences.

Aliases

None

Required?

true

Position

1

Default value

None

Accept pipeline input?

true (ByPropertyName)

Accept wildcard characters?

false

-Path <String[]>

Specifies the path to the file to process. Wildcard syntax is allowed.

Aliases

None

Required?

true

Position

1

Default value

None

Accept pipeline input?

true (ByPropertyName)

Accept wildcard characters?

true

-InputObject <PSObject>

Accepts an object as input to the cmdlet. Enter a variable that contains the objects or type a command or expression that gets the objects.

Aliases

None

Required?

true

Position

named

Default value

None

Accept pipeline input?

true (ByValue)

Accept wildcard characters?

false

-OutputPath <String>

The path to place the expanded file(s). This path must lie on the FileSystem provider.

Aliases

None

Required?

false

Position

2

Default value

The current location of the FileSystem provider.

Accept pipeline input?

false

Accept wildcard characters?

false

-EntryPath <String[]>

The relative path of the file or file(s) inside the archive to expand. For multiple files, use array syntax (comma-separated).

Aliases

None

Required?

false

Position

named

Default value

None

Accept pipeline input?

false

Accept wildcard characters?

true

-FlattenPaths <SwitchParameter>

Store all files in the archives in the root. If multiple files have the same name, the last file in, wins.

Aliases

None

Required?

false

Position

named

Default value

None

Accept pipeline input?

false

Accept wildcard characters?

false

-Force <SwitchParameter>

Aliases

None

Required?

false

Position

named

Default value

None

Accept pipeline input?

false

Accept wildcard characters?

false

-Index <Int32[]>

The index, or indices, of the file(s) inside the archive to expand. For multiple indices, use array syntax (comma-separated).

Aliases

None

Required?

false

Position

named

Default value

None

Accept pipeline input?

false

Accept wildcard characters?

false

-PassThru <SwitchParameter>

Output a FileInfo or DirectoryInfo for each file or directory expanded, respectively.

Aliases

None

Required?

false

Position

named

Default value

None

Accept pipeline input?

false

Accept wildcard characters?

false

-Password <SecureString>

A password to decrypt encrypted entries in the archive, if required.

Aliases

None

Required?

false

Position

named

Default value

Not Set

Accept pipeline input?

false

Accept wildcard characters?

false

-ShowProgress <SwitchParameter>

Show the PowerShell progress bar while performing expansion and scanning operations.

Aliases

None

Required?

false

Position

named

Default value

None

Accept pipeline input?

false

Accept wildcard characters?

false

Input Type

System.IO.FileInfo
Pscx.IO.Compression.ArchiveEntry

Return Type

System.IO.FileSystemInfo

Notes

Supported formats are: SevenZip, Arj, BZip2, Cab, Chm, Compound, Cpio, Deb, GZip, Iso, Lzh, Lzma, Nsis, Rar, Rpm, Split, Tar, Wim, Z, Zip.

Examples

-------------------------- EXAMPLE 1 --------------------------

Expand all zip files in the current directory to .\temp while showing a progress bar.

Expand-Archive -Path *.zip -OutputPath .\Temp\ -ShowProgress

-------------------------- EXAMPLE 2 --------------------------

Search a self-expanding zip file named setup.exe in the current directory for a file named "readme.htm" in a subdirectory named "en-us," and expand it to the current directory.

Expand-Archive -Path setup.exe -EntryPath en-us\readme.htm -format Zip

-------------------------- EXAMPLE 3 --------------------------

Scan through all ISOs in the current directory and expand any files bigger than 1MB to the current directory.

Read-Archive *.iso | where { $_.size -gt 1mb } | Expand-Archive

-------------------------- EXAMPLE 4 --------------------------

Look through all files under x:\ISOs for ISOs that contain a setup.exe in the root, and if so, expand the first twenty files of that ISO to the current directory.

dir x:\ISOs -rec -inc *.iso | Read-Archive | where {$_.path -eq "setup.exe"} | extract-archive -path {$_.archivepath} -index (0..19)