To unzip a file in PowerShell, you can use the Expand-Archive
cmdlet. This cmdlet allows you to extract the contents of a ZIP file to a specified destination.
Here is an example of how to use the Expand-Archive
cmdlet to unzip a file in PowerShell:
Expand-Archive -Path "C:\myZipFile.zip" -DestinationPath "C:\unzipped"
In this example, the Expand-Archive
cmdlet is used to extract the contents of the C:\myZipFile.zip
ZIP file to the C:\unzipped
directory.
You can also use the -Force
parameter to overwrite any existing files in the destination directory. For example, the following code uses the -Force
parameter to unzip the ZIP file and overwrite any existing files:
Expand-Archive -Path "C:\myZipFile.zip" -DestinationPath "C:\unzipped" -Force
To unzip a file in PowerShell, you can use the Expand-Archive
cmdlet. This cmdlet allows you to extract the contents of a ZIP file to a specified destination.
Related tutorials curated for you
What is PowerShell Grep?
What is WhatIf in PowerShell?
How to copy and paste into PowerShell
How to use String Contains in PowerShell
How to use If Else in PowerShell
What are the different PowerShell file types?
How to restart a service in PowerShell
How to join a domain in PowerShell
How to write multiple-line comments in PowerShell
How to list all installed modules in PowerShell
How to ping in PowerShell
Using -Or in PowerShell