我已经知道向菜单或选项添加字母顺序(使用 ExitCodeAscii link),但这种方法会使输出变慢。
有人知道这个问题的快速方法和简单代码吗?
我已经尝试过这段代码:(只是示例)
@echo off
set "AZ1=ABCDEFGHIJKLMNOPQRSTUVWXYZ"
set "AZ2=A B C D E F G H I J K L M N O P Q R S T U V W X Y Z"
set "menu= one two three four five"
for %%A in (%AZ2%) do for %%M in (%menu%) do echo [%%A] %%M
pause
The output:
[A] one
[A] two
[A] three
[A] four
[A] five
[B] one
[B] two
[B] three
etc...
I want the output:
[A] one
[B] two
[C] three
[D] four
[E] five
每次运行外部循环时都会执行内部
for
循环。你不想这样。@echo off
setlocal enabledelayedexpansion
set "AZ1= ABCDEFGHIJKLMNOPQRSTUVWXYZ"
set "menu= one two three four five"
set count=0
for %%M in (%menu%) do (
set /a count+=1
call echo [%%AZ1:~!count!,1%%] %%M
)