Batch scripting multiple selection

后端 未结 2 1019
独厮守ぢ
独厮守ぢ 2020-12-21 19:54

how do you allow the user to type multiple numbers into batch scripting if prompted?

if it prompted 5 options to the user. And the user wanted to choose 1,2,

2条回答
  •  南笙
    南笙 (楼主)
    2020-12-21 20:22

    Like this :

    @echo off
    
    set /p "$choix=Enter you(s) Choice (1,2,...): "
    for  %%a in (%$choix%) do call:choix%%a
    exit/b
    
    
    :choix1
    echo Choice 1
    exit/b
    
    :choix2
    echo Choice 2
    exit/b
    
    :choix3
    echo Choice 3
    exit/b
    

提交回复
热议问题