Last updated on November 22, 2022
In this post, we gonna see how easy it is to unzip a file using PowerShell.
The Microsoft.PowerShell.Archive
module has been introduced in PowerShell 5 with Expand-Archive
the cmdlet. Expand-Archive
cmdlet allows you to easily unzip archives from the command line. The following example unzips the archive download.zip
to a new folder in the current directory.
expand-archive -path 'c:\users\arjun\desktop\download.zip' -destinationpath '.\extracted'
Note that if you omit the -DestinationPath
parameter, PowerShell will automatically create a new folder using the name of the zip archive. In the example above, the new folder would then be downloaded. We can list all the available methods of Microsoft.PowerShell.Archive module with the below command.
Get-Command -Module Microsoft.PowerShell.Archive