我在批处理文件中有这段代码 -
@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
但是,如果我输入" N"它仍然进入"测试"如果我输入" Y"它进入"测试"然后" test2"
答案 0 :(得分:0)
这是一个修改后的版本,可以更好地构建一些东西并修复Magoo提到的问题以及错误使用错误级别:
@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
我也改变了timeout
的,特别是第一次是十六分40秒!