求bat批处理命令 有一个文件夹里有10000张照片,将照片每1000张压缩成一个压缩包,压缩包格zip

2024-12-01 03:10:04
推荐回答(1个)
回答1:

@echo off
:: BY 公子七哥 2013/03/04 20:15
setlocal enabledelayedexpansion
pushd D:\照片\
for /f "tokens=2 delims==" %%a in ('assoc .rar') do set ".rar=%%a"
if not defined .rar echo 找不到压缩软件,按任意键退出。&pause>nul&exit
for /f "tokens=2 delims==" %%a in ('ftype %.rar%') do set rar=%%a
set rar=%rar:"%1"=%
set num=1000999
cd.>%temp%\list.lst
for /f "delims=" %%a in ('dir /a-d /b *.jpg^,*.jpeg^,*.png^,*.bmp') do (
set /a num+=1
echo %%a>>%temp%\list.lst
if !num:~-3!==999 (
%rar% a !num:~-6,-3! @%temp%\list.lst
cd.>%temp%\list.lst
)
)
popd
pause