本帖最后由 qixiaobin0715 于 2022-8-8 19:53 编辑
回复 1# 盛世繁华
抛砖引玉。代码另存为ANSI编码,假设每次复制2个文件到文件夹中,Groups=2。未测试:- @echo off
- set Groups=2
- setlocal enabledelayedexpansion
- for /f "delims=" %%i in ('dir /b /a-d^|findstr /e "jpg jpeg png bmp"') do (
- set /a n+=1
- set _!n!=%%i
- )
-
- set m=0
- for /d %%i in (*) do (
- for /l %%j in (1,1,%Groups%) do (
- set /a m+=1
- for %%k in (_!m!) do copy "!%%k!" "%%i\"
- if !m! equ !n! set m=0
- )
- )
- pause
复制代码
|