看看高手我的
哈哈,开个玩笑,其实我研究好久才搞明白- @echo off
- setlocal enableDelayedExpansion
- set/a A=%random%%%5*9
- set/a B=(%random%%%3+1)*3
- set fuhao=+-*/
- set/a n=0
- :calc
- set/a RS=%A%!fuhao:~%n%,1!%B%
- echo %A% !fuhao:~%n%,1! %B% = %RS%
- set/a n+=1
- if not "!fuhao:~%n%,1!"=="" goto :calc
- goto :eof
复制代码 wxcute老大,我仍然有个疑问,为什么在变量截取!fuhao:~%n%,1!中只能用%n%而不能是!n!呢? |