The PowerShell shell is useful for various tasks such automation and configurations management. PowerShell comes pre-installed on windows. It was built to be somewhat a successor to CMD packed with all CMD features and more. CMD is the default command line interpreter for windows.
In this guide we will be simply covering how to zip and unzip files using PowerShell.
ZIP using PowerShell
In order to zip files using PowerShell, PowerShell uses the Compress-Archive module built in to PowerShell.
To simply compress a file we use the below schema:
Compress-Archive -Path <folder/file-path> -DestinationPath <new-zip-filename.zip>
Unzip using PowerShell
In order to unzip files using PowerShell, PowerShell uses the Expand-Archive module built in to PowerShell.
To simply unzip a file we use the below schema:
Expand-Archive <filename.zip> -DestinationPath <unzip-to-folder>
Zipping and unzipping files using PowerShell is useful in scripting scenarios where you don't have access to graphical user interface (GUI).