Decompresses a ZIP file to a directory using the
Expand-Item [-Path] <String> [[-OutDirectory] <String>] [-Force] [-WhatIf] [-Confirm] [<CommonParameters>]
The contents of the ZIP file are extracted to a temporary directory, and that directory is returned as a
System.IO.DirectoryInfo object. You are responsible for deleting that directory when you're finished.
You can extract to a specific directory with the
OutDirectory parameter. If the directory doesn't exist, it is created. If the directory exists, and is empty, the file is decompressed into that directory. If the directory isn't empty, use the
-Force parameter to overwrite any files/directories which may be present.
The directory where the files were decompressed is returned.
|Name||Type||Description||Required?||Pipeline Input||Default Value|
The path to the files/directories to compress.
Path to a directory where the file should be extracted.
Overwrite any existing files/directories in
|CommonParameters||This cmdlet supports common parameters. For more information type
$unzipRoot = Expand-Item -Path 'C:\Carbon.zip'
Demonstrates how to unzip a file into a temporary directory. You are responsible for deleting that directory.
Expand-Item -Path 'C:\Carbon.zip' -OutDirectory 'C:\Modules\Carbon'
Demonstrates how to unzip a file into a specific directory.
Expand-Item -Path 'C:\Carbon.zip' -OutDirectory 'C:\Modules\Carbon' -Force
Demonstrates how to decompress to an existing, non-empty directory with the
-Force parameter. Existing files are overwritten.