@echo off
setlocal
set sourceDirectory=your_dir
set zipFilePath=your_zip_file_path
REM 检查压缩文件是否存在,若存在则删除
if exist %zipFilePath% del %zipFilePath%
powershell -Command "& { Add-Type -AssemblyName System.IO.Compression.FileSystem; [System.IO.Compression.ZipFile]::CreateFromDirectory('%sourceDirectory%', '%zipFilePath%'); }"
echo 压缩完成:%zipFilePath%
pause
03-23
2416
![](https://csdnimg.cn/release/blogv2/dist/pc/img/readCountWhite.png)
12-13
2486
![](https://csdnimg.cn/release/blogv2/dist/pc/img/readCountWhite.png)
08-29
878
![](https://csdnimg.cn/release/blogv2/dist/pc/img/readCountWhite.png)
07-28
08-21
04-02