How to use Powershell command Compress-Archive to create a zip file.
How to use Powershell command Expand-Archive to extract a zip file.
#Create a zip file by selecting individual files.
$backup= Compress-Archive -LiteralPath C:\Users\Nick\Downloads\1.txt, C:\Users\Nick\Downloads\2.txt, C:\Users\Nick\Downloads\3.txt -CompressionLevel Optimal -DestinationPath C:\Users\Nick\Downloads\output\test-files.zip
$backup
#Create a zip file by selecting individual folders.
$backup= Compress-Archive -Path C:\Users\Nick\Downloads\sub1, C:\Users\Nick\Downloads\sub2 -CompressionLevel Optimal -DestinationPath C:\Users\Nick\Downloads\output\test-folders
$backup
#Add the contents of a folder and its sub folders to an existing zip file.
$backup= Compress-Archive -Path C:\Users\Nick\Downloads\extra\* -Update -DestinationPath C:\Users\Nick\Downloads\output\test-folders.zip
$backup
#Extract a zip file using full directory location path.
$backup= Expand-Archive -LiteralPath C:\Users\Nick\Downloads\output\test-files.zip -DestinationPath C:\Users\Nick\Downloads\restored
$backup
#Extract a zip file in the current working directory.
$backup= Expand-Archive -Path test-folders.zip -DestinationPath C:\Users\Nick\Downloads\restored
$backup
This video is brought to you by https://www.lockard.it