回复 5# laiu888 - @echo off
- :begin
- set /a b=%random%%%20
- if defined _%b% goto begin
- set /p=%b% <nul
- set /a n+=1,_%b%=%b%
- if %n% lss 5 goto begin
- pause>nul
复制代码
- @echo off
- :begin
- set /a b=%random%%%20
- if defined %b% goto begin
- set /p=%b% <nul
- set /a n+=1,%b%=%b% 2>nul
- if %n% lss 5 goto begin
- pause>nul
复制代码 去掉echo off 自己体会下
因为变量b的值是固定的
_%b%这个%b%的值不是固定的 |