本帖最后由 pcl_test 于 2016-8-14 10:38 编辑
目的是为了随机生成一个“A”~“j”之间的大写字母赋给变量ver1 ver2 ver3 ver4 ver5 (越洁的程序越好. 复杂化了.初学的我.真的不懂)
出现- @echo off&setlocal enabledelayedexpansion
- set "str=ABCDEFGHIJ"
- set/a a=%random%%%5
- set/a b=%random%%%5
- set/a c=%random%%%5
- set/a d=%random%%%5
-
- set var1=!str:~%a%,1!
- set var2=!str:~%b%,1!
- set var3=!str:~%c%,1!
- set var4=!str:~%d%,1!
-
-
- echo !str:~%a%,1!
- pause
-
- echo !var1!
- echo !var2!
- echo !var3!
- echo !var4!
- echo !var5!
复制代码
|