- @echo off
- set a=20
- for /d %%a in (*) do (
- pushd "%%a"
- setlocal enabledelayedexpansion
- for %%b in (*.jpg) do (
- set /a n+=1
- set #!random!_!n!=%%b
- )
- if !n! gtr %a% (
- for /f "skip=%a% tokens=1* delims==" %%c in ('set #') do del "%%d"
- )
- endlocal
- popd
- )
- pause
复制代码
|