Batch choice /c

Status
Niet open voor verdere reacties.

somfic

Gebruiker
Lid geworden
14 jul 2013
Berichten
43
Hi,

Ik heb dit scriptie gemaakt om een wachtwoord in te vullen:

Code:
@echo off
color 0F
cls

set 1=0
set 2=0
set 3=0
set 4=0


:start
cls
echo.
PING 1.1.1.1 -n 1 -w 3000 >NUL

echo .  .  .  . 
choice /c 123456789 /n 
IF ERRORLEVEL 9 GOTO set 2=9                            :evil:
IF ERRORLEVEL 8 GOTO set 2=8
IF ERRORLEVEL 7 GOTO set 2=7
IF ERRORLEVEL 6 GOTO set 2=6
IF ERRORLEVEL 5 GOTO set 2=5
IF ERRORLEVEL 4 GOTO set 2=4
IF ERRORLEVEL 3 GOTO set 2=3
IF ERRORLEVEL 2 GOTO set 2=2
IF ERRORLEVEL 1 GOTO set 2=1

cls
echo * .  .  . 
choice /c 123456789 /n 
IF ERRORLEVEL 9 GOTO set 2=9
IF ERRORLEVEL 8 GOTO set 2=8
IF ERRORLEVEL 7 GOTO set 2=7
IF ERRORLEVEL 6 GOTO set 2=6
IF ERRORLEVEL 5 GOTO set 2=5
IF ERRORLEVEL 4 GOTO set 2=4
IF ERRORLEVEL 3 GOTO set 2=3
IF ERRORLEVEL 2 GOTO set 2=2
IF ERRORLEVEL 1 GOTO set 2=1

cls
echo * * .  .
choice /c 123456789 /n 
IF ERRORLEVEL 9 GOTO set 3=9
IF ERRORLEVEL 8 GOTO set 3=8
IF ERRORLEVEL 7 GOTO set 3=7
IF ERRORLEVEL 6 GOTO set 3=6
IF ERRORLEVEL 5 GOTO set 3=5
IF ERRORLEVEL 4 GOTO set 3=4
IF ERRORLEVEL 3 GOTO set 3=3
IF ERRORLEVEL 2 GOTO set 3=2
IF ERRORLEVEL 1 GOTO set 3=1

cls
echo * * *  .
choice /c 123456789 /n 
IF ERRORLEVEL 9 GOTO set 1=9
IF ERRORLEVEL 8 GOTO set 1=8
IF ERRORLEVEL 7 GOTO set 1=7
IF ERRORLEVEL 6 GOTO set 1=6
IF ERRORLEVEL 5 GOTO set 1=5
IF ERRORLEVEL 4 GOTO set 1=4
IF ERRORLEVEL 3 GOTO set 1=3
IF ERRORLEVEL 2 GOTO set 1=2
IF ERRORLEVEL 1 GOTO set 1=1

cls
echo * * * *
pause

als ik hem echter start, geeft hij een fout bij de :evil:

Help please........
 
Laatst bewerkt door een moderator:
somfic,

Code:
@echo off
color 0F
cls

set 1=0
set 2=0
set 3=0
set 4=0


:start
cls
echo.
PING 1.1.1.1 -n 1 -w 3000 >NUL

echo . . . .
@CHOICE /C:123456789 /n
IF ERRORLEVEL 9 GOTO next9
IF ERRORLEVEL 8 GOTO next8
IF ERRORLEVEL 7 GOTO next7
IF ERRORLEVEL 6 GOTO next6
IF ERRORLEVEL 5 GOTO next5
IF ERRORLEVEL 4 GOTO next4
IF ERRORLEVEL 3 GOTO next3
IF ERRORLEVEL 2 GOTO next2
IF ERRORLEVEL 1 GOTO next1
GOTO part2
:next1
set a=1
goto part2
:next2
set a=2
goto part2
:next3
set a=3
goto part2
:next4
set a=4
goto part2
:next5
set a=5
goto part2
:next6
set a=6
goto part2
:next7
set a=7
goto part2
:next8
set a=8
goto part2
:next9
set a=9
goto part2

:part2

cls
echo * . . .
@CHOICE /C:123456789 /n
IF ERRORLEVEL 9 GOTO next90
IF ERRORLEVEL 8 GOTO next80
IF ERRORLEVEL 7 GOTO next70
IF ERRORLEVEL 6 GOTO next60
IF ERRORLEVEL 5 GOTO next50
IF ERRORLEVEL 4 GOTO next40
IF ERRORLEVEL 3 GOTO next30
IF ERRORLEVEL 2 GOTO next20
IF ERRORLEVEL 1 GOTO next10
GOTO part3
:next10
set b=1
goto part3
:next20
set b=2
goto part3
:next30
set b=3
goto part3
:next40
set b=4
goto part3
:next50
set b=5
goto part3
:next60
set b=6
goto part3
:next70
set b=7
goto part3
:next80
set b=8
goto part3
:next90
set b=9
goto part3

:part3

cls
echo * * . .
@CHOICE /C:123456789 /n
IF ERRORLEVEL 9 GOTO next91
IF ERRORLEVEL 8 GOTO next81
IF ERRORLEVEL 7 GOTO next71
IF ERRORLEVEL 6 GOTO next61
IF ERRORLEVEL 5 GOTO next51
IF ERRORLEVEL 4 GOTO next41
IF ERRORLEVEL 3 GOTO next31
IF ERRORLEVEL 2 GOTO next21
IF ERRORLEVEL 1 GOTO next11
GOTO part4
:next11
set c=1
goto part4
:next21
set c=2
goto part4
:next31
set c=3
goto part4
:next41
set c=4
goto part4
:next51
set c=5
goto part4
:next61
set c=6
goto part4
:next71
set c=7
goto part4
:next81
set c=8
goto part4
:next91
set c=9
goto part4

:part4

cls
echo * * * .
@CHOICE /C:123456789 /n
IF ERRORLEVEL 9 GOTO next92
IF ERRORLEVEL 8 GOTO next82
IF ERRORLEVEL 7 GOTO next72
IF ERRORLEVEL 6 GOTO next62
IF ERRORLEVEL 5 GOTO next52
IF ERRORLEVEL 4 GOTO next42
IF ERRORLEVEL 3 GOTO next32
IF ERRORLEVEL 2 GOTO next22
IF ERRORLEVEL 1 GOTO next12
GOTO part5
:next12
set d=1
goto part5
:next22
set d=2
goto part5
:next32
set d=3
goto part5
:next42
set d=4
goto part5
:next52
set d=5
goto part5
:next62
set d=6
goto part5
:next72
set d=7
goto part5
:next82
set d=8
goto part5
:next92
set d=9
goto part5

:part5
cls
echo * * * *

echo %a%
echo %b%
echo %c%
echo %d%

pause

de laatste regels zoals echo %a% kun je natuurlijk weghalen.
Deze heb ik puur gedaan om te testen.
 
Laatst bewerkt:
Status
Niet open voor verdere reacties.
Terug
Bovenaan Onderaan