用了最笨的方法,但可以实现功能
为什么我总是想不到简单的方法,是我对命令还不够熟悉吗?- @echo off
- setlocal enabledelayedexpansion
- :sat
- set num=%random%
- if %num% lss 1000 goto :sat
- if %num% gtr 9999 goto :sat
- set a=%num:~0,1%
- set b=%num:~1,1%
- set c=%num:~2,1%
- set d=%num:~3,1%
- echo !a!
- echo !b!
- echo !c!
- echo !d!
- if !a! == !b! goto :sat
- if !a! == !c! goto :sat
- if !a! == !d! goto :sat
- if !b! == !c! goto :sat
- if !b! == !d! goto :sat
- if !c! == !d! goto :sat
- echo %num%
- pause
复制代码
|