@echo off set "string=6 7 8 9 10 11 12 14 15 16 17" for %%i in (%string%) do call set /a "n=%%n%%+1" set /a "tn=(%random%)%%(%n%)+1" for /f "usebackq tokens=%tn% delims= " %%i in ('%string%') do echo %%i pause goto :EOF
复制代码 代码如下:
@echo off set "string=6 7 8 9 10 11 12 14 15 16 17" for %%i in (%string%) do call set /a "n=%%n%%+1" set /a "n=(%random%)%%(%n%)+1" for /f "usebackq tokens=%n% delims= " %%i in ('%string%') do echo %%i pause goto :EOF