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
 

Read-Archive

Read-Archive

pscx.dll

Synopsis

PSCX Cmdlet: Enumerates compressed archives such as 7z or rar, emitting ArchiveEntry objects representing records in the archive.

Syntax

Read-Archive [-Path] [-IncludeDirectories] [-ShowProgress] [<CommonParameters>]

Read-Archive [-InputObject] [-IncludeDirectories] [-ShowProgress] [<CommonParameters>]

Read-Archive [-LiteralPath] [-IncludeDirectories] [-ShowProgress] [<CommonParameters>]

Detailed Description

Enumerates compressed archives such as 7z or rar, emitting ArchiveEntry objects representing records in the archive.Read-Archive is used to list the contents of a compressed archive containing one or more compressed file(s). The format of the file being read can be overriden with the Format parameter, for example to enumerate the contents of a self-extracting archive (EXE).Read-Archive is useful if you wish to perform filtering using standard pipeline Where-Object and/or ForEach-Object cmdlets before piping ArchiveEntry objects to Expand-Archive.

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

-IncludeDirectories <SwitchParameter>

If present, directs Read-Archive to list the 0-length directory entries that represent folders in the archive.

Aliases

None

Required?

false

Position

named

Default value

None

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

Return Type

Pscx.IO.Compression.ArchiveEntry

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 --------------------------

Read all ISO compressed archives and dump the contents into a text file.

Read-Archive -Path *.iso > contents.txt

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

Read contents from a self-extracting zip file and expand any txt files into the current filesystem location.

Read-Archive -Path Setup.exe -Format Zip | Where-Object { $_.Name -like "*.txt" } | Expand-Archive