2017-08-22 7 views
-3

Ich habe diesen Code in einer Batch-Datei -Batch - gehe zu gehen nicht zu

@echo off 
title Bloons Trivia Quiz by LumiteDubbz 
color f0 
:intro 
echo -----------===========----------- 
echo Welcome to the Bloons Trivia Quiz! 
echo -----------===========----------- 
echo --------------------------------- 
echo Press any key to continue the fun! 
timeout 1000 >nul 
choice /c yn /m "Do you want to activate Dark Mode?" 
if "%errorlevel%" == "1" goto :test 
if "%errorlevel%" == "0" goto :test2 
:test 
color 0f 
echo Dark Mode activated! 
timeout 10 
cls 
:test2 
color f0 
echo Light Mode sustained! 
pause 

Allerdings, wenn ich Typ „N“ noch zu „Test“ geht und wenn ich Typ „Y“ es geht an " Test“, dann‚test2‘

+1

Versuchen Sie direkt nach der "Auswahl" -Zeile, echo "% errorlevel%" und kommen Sie zu Ihrer eigenen Schlussfolgerung. – Magoo

+0

Danke, wer auch immer die modifizierte Version gab! Funktioniert ein Charme! Kann ein Administrator dies jetzt als archiviert markieren? – LumiteDubbz

+0

Drücken Sie einfach das große Häkchen neben der Antwort, wodurch die Frage als beantwortet und als Pluspunkte markiert wird. – Magoo

Antwort

0

Hier ist eine modifizierte Version, welche Strukturen die Dinge ein wenig besser und behebt das Problem von Magoo und Ihre falschen Verwendung von Fehlerebenen erwähnt:

@Echo Off 
Title Bloons Trivia Quiz by LumiteDubbz 

:Intro 
Echo -----------===========----------- 
Echo Welcome to the Bloons Trivia Quiz! 
Echo -----------===========----------- 
Echo --------------------------------- 
Echo Press any key to continue the fun! 
Pause>Nul 
Choice /M "Do you want to activate Dark Mode?" 
If ErrorLevel 2 GoTo LMode 

:DMode 
Color 0F 
Echo Dark Mode activated! 
GoTo Next 

:LMode 
Color F0 
Echo Light Mode activated! 

:Next 
Timeout 3 /NoBreak>Nul 
Rem Further commands go below here 
ClS 
Echo Closing ... 
Timeout 3 /NoBreak>Nul 

ich habe mich verändert auch die timeout 's vor allem als der erste war 16 Minuten und 40 Sekunden lang!