Zip in Windows 10 Pro batch file

Zip in Windows 10 Pro batch file

The Windows 10 Pro command prompt does not have a command to compress zip.

However, PowerShell has a Compress-Archive command, so you can call PowerShell’s ps1 file from a batch file to compress it.

The file layout configuration is as follows.


The folder to be compressed is assumed to be the same as the one under the folder.

Folder you want to compress Compressed Folder Name


@echo off
powershell -ExecutionPolicy Unrestricted .\a.ps1
exit /b


Compress-Archive -Path C:\temp\common\ -DestinationPath C:\temp\

Execute this file.

Windows 10 Proのバッチファイルでzip圧縮する

I was able to run the batch file and zip it.

Use the powershell command

Zip the file using the powershell command in a batch file without creating a ps1 file.


@echo off
powershell compress-archive common

Execute zip command via wsl

If you have a Linux environment with wsl, you can use the zip command via the wsl command.

Install the zip command via wsl sudo apt install zip.

Compress the file under c:\tmp\ to

c:\tmp>wsl zip a -r9 .


Discover more from 株式会社CONFRAGE ITソリューション事業部

Subscribe now to keep reading and get access to the full archive.

Continue reading

Copied title and URL