Opgelost Batch file met keuzemenu > B1, B2, B3, C1, C2 etc t/m Z1, Z2, Z3, Z4 etc

  • Onderwerp starter Onderwerp starter Senso
  • Startdatum Startdatum
Dit topic is als opgelost gemarkeerd
Status
Niet open voor verdere reacties.

Senso

Inventaris
Lid geworden
13 jun 2016
Berichten
11.229
Besturingssysteem
W10 Pro en W11 Pro
Office versie
Office 2007 H&S en Office 2021 Prof Plus
De keuze bestaat uit een letter en cijfer (1 of 2 cijfers)
Onderstaande zal niet goed zijn denk ik.

rem ECHO.
ECHO/
SET /P M=Type A1, B1, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, or 32 then press ENTER:
IF %M%==A1 GOTO A1
IF %M%==A2 GOTO A2
IF %M%==3 GOTO 3
IF %M%==4 GOTO 4
IF %M%==5 GOTO 5
IF %M%==6 GOTO 6
IF %M%==7 GOTO 7
IF %M%==8 GOTO 8
IF %M%==9 GOTO 9
IF %M%==10 GOTO 10
IF %M%==11 GOTO 11
IF %M%==12 GOTO 12
IF %M%==13 GOTO 13
IF %M%==14 GOTO 14
IF %M%==15 GOTO 15
IF %M%==16 GOTO 16
IF %M%==17 GOTO 17
IF %M%==18 GOTO 18
IF %M%==19 GOTO 19
IF %M%==20 GOTO 20
IF %M%==21 GOTO 21
IF %M%==22 GOTO 22
IF %M%==23 GOTO 23
IF %M%==24 GOTO 24
IF %M%==25 GOTO 25
IF %M%==26 GOTO 26
IF %M%==27 GOTO 27
IF %M%==28 GOTO 28
IF %M%==29 GOTO 29
IF %M%==30 GOTO 30
IF %M%==31 GOTO 31
rem -------------------------------------------------------
IF %M%==32 GOTO EOF
ECHO Ongeldige code
PAUSE
GOTO MENU
rem -------------------------------------------------------
 
Laatst bewerkt:
Je vragen zijn -zondere enige context- weer zo vaag…. 🤔
 
Iemand die er verstand van heeft weet wel wat de bedoeling is.
Als je A1 tm A10 en B1 tm B10 etc. het hele alfabet moet je dan alles tig keer typen?
als je een doorsluisteken (volgende regel) kunt gebruiken zou het al gemakkelijker/overzichtelijker zijn.

SET /P M=Type a1, a2, a3, a4, a5, a6, a7, a8, a9, a10, a11, a12, a13, a14, a15, then press ENTER:
en dat 26 x? En dan nog de rest?

IF %M%==A1 GOTO A1
IF %M%==a1 GOTO A1
IF %M%==B1 GOTO B1
IF %M%==b1 GOTO B1
en dat voor hele alfabet A-Z en 1-10?
 
Laatst bewerkt:
Je zegt niet wat er dan volgens jou niet goed is, maar dit werkt prima:
Code:
ECHO OFF
:MENU
SET /P M=Type A1, B1, 3 t/m 32 then press ENTER:
IF %M%==A1 GOTO A1
IF %M%==a1 GOTO A1
IF %M%==B1 GOTO B1
IF %M%==b1 GOTO B1
IF %M%==3 GOTO 3
IF %M%==4 GOTO 4
IF %M%==5 GOTO 5
IF %M%==6 GOTO 6
IF %M%==7 GOTO 7
IF %M%==8 GOTO 8
IF %M%==9 GOTO 9
IF %M%==10 GOTO 10
IF %M%==11 GOTO 11
IF %M%==12 GOTO 12
IF %M%==13 GOTO 13
IF %M%==14 GOTO 14
IF %M%==15 GOTO 15
IF %M%==16 GOTO 16
IF %M%==17 GOTO 17
IF %M%==18 GOTO 18
IF %M%==19 GOTO 19
IF %M%==20 GOTO 20
IF %M%==21 GOTO 21
IF %M%==22 GOTO 22
IF %M%==23 GOTO 23
IF %M%==24 GOTO 24
IF %M%==25 GOTO 25
IF %M%==26 GOTO 26
IF %M%==27 GOTO 27
IF %M%==28 GOTO 28
IF %M%==29 GOTO 29
IF %M%==30 GOTO 30
IF %M%==31 GOTO 31
rem -------------------------------------------------------
IF %M%==32 GOTO EOF
ECHO Ongeldige code
PAUSE
GOTO MENU
:EOF
rem -----------------------------------------------------
 
Hoe gek wil je een gebruiker maken met al die keuzes?
Kort ze af zoals in mijn voorbeeld.
 
Laatst bewerkt:
Ja, het lijkt wat gek, maar soms wil je iets proberen. Valt dan tegen maar we gaan nog even door.

Ik weet niet wat je met afkorten bedoelt. Het is een hele waslijst van AtmZ. Maar goed, ik ben nu bezig alle letters onder te brengen. Geen zin meer dan stop ik wel. Lukt het toch niet dan is het jammer.
 
Voor een dergelijk menu is een bat file niet geschikt.
Maak dan een mooi menu in Excel met VBA in een Userform, of direct in Visual Studio Basic.
 
Je zou ook met een hoofdmenu en submenu's kunnen werken, dan zijn de keuzelijsten niet zo lang. zie bijgaand voorbeeld. Even opslaan als menu.bat.
 

Bijlagen

Ook een leuke :D
 
Status
Niet open voor verdere reacties.
Terug
Bovenaan Onderaan