< Back

Expand-MrZipFile

Sat Jan 18, 2020 4:34 pm

NAME Expand-MrZipFile



SYNOPSIS

Expand-MrZipFile is a function which extracts the contents of a zip file.





SYNTAX

Expand-MrZipFile [-File] <String> [[-Destination] <String>] [-ForceCOM] [<CommonParameters>]





DESCRIPTION

Expand-MrZipFile is a function which extracts the contents of a zip file specified via the -File parameter to the

location specified via the -Destination parameter. This function first checks to see if the .NET Framework 4.5

is installed and uses it for the unzipping process, otherwise COM is used.





PARAMETERS

-File <String>

The complete path and name of the zip file in this format: C:\\zipfiles\\myzipfile.zip



Required? true

Position? 1

Default value

Accept pipeline input? true (ByValue)

Accept wildcard characters? false



-Destination <String>

The destination folder to extract the contents of the zip file to. If a path is no specified, the current path

is used.



Required? false

Position? 2

Default value (Get-Location).Path

Accept pipeline input? false

Accept wildcard characters? false



-ForceCOM [<SwitchParameter>]

Switch parameter to force the use of COM for the extraction even if the .NET Framework 4.5 is present.



Required? false

Position? named

Default value False

Accept pipeline input? false

Accept wildcard characters? false



<CommonParameters>

This cmdlet supports the common parameters: Verbose, Debug,

ErrorAction, ErrorVariable, WarningAction, WarningVariable,

OutBuffer, PipelineVariable, and OutVariable. For more information, see

about_CommonParameters (https:/go.microsoft.com/fwlink/?LinkID=113216).



INPUTS

String





OUTPUTS

None





NOTES





Author: Mike F Robbins

Website: http://mikefrobbins.com

Twitter: @mikefrobbins



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



PS C:\\>Expand-MrZipFile -File C:\\zipfiles\\AdventureWorks2012_Database.zip -Destination C:\\databases\\













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



PS C:\\>Expand-MrZipFile -File C:\\zipfiles\\AdventureWorks2012_Database.zip -Destination C:\\databases\\ -ForceCOM













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



PS C:\\>'C:\\zipfiles\\AdventureWorks2012_Database.zip' | Expand-MrZipFile













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



PS C:\\>Get-ChildItem -Path C:\\zipfiles | ForEach-Object {$_.fullname | Expand-MrZipFile -Destination C:\\databases}















RELATED LINKS