taofan712 当前离线
六级士官
评分人数
a2002 (a2002)当前离线
四级士官
@echo off&setlocal enabledelayedexpansion set /a i=0,j=0 for /f "tokens=1-5 delims= " %%A in (test.txt) do ( set "s_!j!=%%A %%B %%C %%D %%E"&set /a j+=1 for %%# in (%%A %%B %%C %%D %%E) do set r_!i!=%%#&set /a i+=1 ) set /a r=!random!%%60,_r=r/5 echo !r_%r%!&pause echo !s_%_r%!&pause复制代码
TOP
qazplm 当前离线
上等兵
@echo off set /a n=%random% %% 12,m=%random% %% 5+1,t=n+1 echo;%t%行 %m%列 for /f "delims=" %%a in ('more +%n% "文本.txt"') do ( for /f "tokens=%m%" %%b in ("%%a") do echo;%%b pause echo;%%a goto end ) :end pause>nul复制代码
老刘1号 当前离线
论坛巡查
Rem Code BY 老刘 Rem 文本换行标记必须为CrLf [文本内容] = CreateObject("scripting.FilesystemObject").getfile(".\1.txt").OpenAsTextStream.Readall Randomize : [行] = fix(rnd*12) : [列] = fix(rnd*5) '由于数组从0开始,所以无需加1,得到0也正常 Msgbox Split(split([文本内容],VbCrlf)([行]))([列])&Vbcrlf&split([文本内容],VbCrlf)([行])复制代码