fanfande 当前离线
中尉
评分人数
CrLf 当前离线
论坛巡查
TOP
batman 当前离线
考官
荣誉版主
@echo off rem 自己将x改为你设定的值。。。 set /p n=请输入数字(不得大于x-1): set /a m=x-n for %%a in (a-%n% b-%m%) do ( for /f "tokens=1,2 delims=-" %%b in ("%%a") do ( setlocal enabledelayedexpansion for %%d in (%%b/*.txt) do set "_!random!_%%~nxd=%%d" for /f "tokens=2 delims==" %%e in ('set _') do ( set /a n+=1 if !n! leq %%c copy /y "%%e" "c:\" ) endlocal ) )复制代码
@echo off&setlocal enabledelayedexpansion set /p m=要随机选取的文件数量 (for %%a in (a\*.txt b\*.txt) do ( echo !random!!random!!random!!random!!random!%%a set /a n+=1,sort=n%%5+1,"m+=^!((m-n)>>31)*(n-m)" ))>tmp for /f "skip=%m% delims=" %%a in ("sort /+%sort% tmp") do ( copy %%~sa c\ ) del tmp复制代码
@echo off&setlocal enabledelayedexpansion for %%a in (a b) do ( for %%b in (%%a\*.txt) do ( set /a a=!random!%%2 if !a! equ 0 move "%%b" c\ ) )复制代码