- @echo off
- :loop
- for %%a in (a1 a2) do call :rnd %%a
- if a1==a2 goto loop
- echo;随机两个字母为:%a1% %a2%
-
- setlocal enabledelayedexpansion
- for /l %%a in (1 1 5) do (
- set /a n=!random!%%2
- if !n! equ 0 (set ok=!ok!!a1!) else (set ok=!ok!!a2!)
- )
- echo;%ok%&pause>nul
- exit
-
- :rnd
- set str=abcdefghijklmnopqrstuvwxyz
- setlocal enabledelayedexpansion
- set /a rnd=%random%%%26
- call set str=%%str:~%rnd%,1%%
- endlocal&set %1=%str%
- goto :eof
复制代码
|