How to Zip Files Using PowerShell [with Bonus Tip]

There are several workable ways to zip your files, and one of the most common is using third-party software. But this post will help you zip files using the Windows built-in tool PowerShell. Keep reading to learn how to zip files using PowerShell.

PowerShell is a cross-platform task automation tool that runs on Windows, Linux, and macOS. This tool can help you with various tasks, such as writing scripting languages and configuration management frameworks. This post from EaseUS will help you Zip files using PowerShell and how to repair corrupted Zip files.

How to Zip Files Using PowerShell

Let's first look at how to archive and zip your files using PowerShell. You can choose to zip your files one by one or the whole folder at the same time.

Step 1. Launch PowerShell by typing its name in the search bar or start menu the following command:

Compress-Archive -LiteralPath -DestinationPath

📓Note: You need to replace with the file path of the file you want to zip. Also, you need to pay attention that your file needs to be saved as ".zip"

Step 2. To zip the entire folder, type the following command in PowerShell. Replace and with the path to the files you want to compress.

Step 3. What's more, if your folder contains different types of files, you need to enter the following command:

Compress-Archive -Path C:\path\to\file\*.jpg -DestinationPath C:\path\to\archive.zip

You can share this post with users in need on social media like Twitter or Reddit:

 

How to Repair Corrupted Zipped Files

If your compressed and zipped files are corrupt and damaged due to specific reasons after you zip them using PowerShell, you can use Zip file repair software to get them fixed to the original state. EaseUS Fixo File Repair will be your go-to choice if you want to fix Zip file not opening.

Follow the detailed steps here to solve the Zip file won't open error and repair corrupted Zip files:

Step 1. Download and install EaseUS Fixo File Repair on your PC and launch it. In the left panel, choose "File Repair" and tap on the green "Add File" button to upload files.

Step 2. Then, move your cursor to the file you want to repair and click "Repair." If you want to repair corrupt Zip files in batch, click on "Repair All."

Step 3. Once the repair process is done, tap on the "Save" button to save the repaired Zip file to a new location. Then, you can click "view repaired" to preview the repaired files.

FAQs on Zip Files Using PowerShell

Here are some questions on this topic that have been asked frequently. 

1. How to zip a file using PowerShell?

If you want to zip and compress your files with PowerShell, you need just need to open PowerShell and run it as administrator. Then type the following command and press Enter:

Compress-Archive -Path C:\SOURCE\FILES\* -CompressionLevel Optimal -DestinationPath C:\DESTINATION\ZIPPEDFILE. zip

2. How to compress large files using PowerShell?

If your files are too large, you can try another method to zip your files. Do as follows:

  • Find the file or folder you want to compress.
  • Right-click on the file or folder and choose "Send to" from the menu, ane then select Compressed (zipped) folder.

Closure

This post has discussed how to Zip files using PowerShell and how to repair corrupted Zip files if your files are corrupted and damaged. You can always use EaseUS Fixo File Repair as your last resort. Download and try it now!