freesoft00 当前离线
六级士官
评分人数
happy886rr 当前离线
等待验证会员
@echo off title 行赋值演示 mode con cols=60 lines=10 REM 随机一行赋值给变量L seti L=(line%RANDOM:~-1%)%~f0 REM 显示变量L的值,即被随机的行 echo;%L% pause>NUL exit 复制代码
TOP
WHY 当前离线
上校
@echo off & setlocal enabledelayedexpansion for /f %%i in ('find /v /c "" ^< a.txt') do set /a n = !Random! %% %%i + 1 (for /l %%i in (1 1 %n%) do set /p str=)<a.txt echo;!str! pause复制代码
@echo off & setlocal enabledelayedexpansion for /f "delims=" %%i in (a.txt) do set /a n+=1 & set "_!n!=%%i" set /a n = %Random% %% n + 1 set "str=!_%n%!" & echo;!str! pause复制代码