我有一个非常奇怪的问题,我无法解释 当我运行程序时,代码中会出现一个随机括号。
(开头没有@echo)
C:\Users\wodahS>set /p ProgramTask=wodahS:
wodahS: How are you feeling Aimi?
C:\Users\wodahS>if ["How are you feeling Aimi?"] == [""] goto PROGRAM
C:\Users\wodahS>timeout 1 /nobreak 1>nul
) was unexpected at this time.
C:\Users\wodahS> )
if "%ProgramTask%" == "I wont be able to talk to you for a while" (
:UnableTalk
cls
echo.
echo Aimi: Why not??
set /a Happiness-= 3
set /p Reason=%Us%:
timeout 1/nobreak >nul
echo.
if "%Reason%" == "I've got homework to do" (
)
if "%Reason%" == "I've got work to do" (
)
if "%Reason%" == "We're travelling" (
cls
echo Aimi: What?!?
timeout 1 /nobreak >nul
echo Aimi: Where To??
timeout 1 /nobreak >nul
:TravelDest
set /p TravelDes=%Us%:
timeout 1 /nobreak >nul
if "%TravelDes%" == "School" (
)
if "%TravelDes%" == "Town" (
)
if "%TravelDes%" == "Poland" (
cls
color 0d
echo Aimi: What??!?!? Are You Serious??
timeout 1 /nobreak >nul
echo Aimi: OMG!! Finally!!!
set /a Excitement+=25
timeout 1 /nobreak >nul
if %BondS% GTR 50 (
echo Aimi: Does that mean that I'm going to meet your uncle?!
timeout 1 /nobreak >nul
set /p MeetUncleQ=%Us%:
if "%MeetUncleQ%" == "Yeah" (
echo Aimi: Oh My God!! Im so excited!!
set /a Excitement+=10
)
)
)
if "%TravelDes%" == "My friend's house" (
)
echo Aimi: What? I dont understand.
timeout 1 /nobreak >nul
echo.
goto TravelDest
)
if "%Reason%" == "Never Mind" (
echo Aimi: Ummm... Okay?
set /a Curiousity+=2
timeout 1 /nobreak >nul
goto PROGRAM
)
echo Aimi: What? I dont understand.
timeout 1 /nobreak >nul
goto UnableTalk
)
答案 0 :(得分:0)
您不能在块命令(括号内的一系列行)中使用标签:UnableTalk
,:TravelDest
,因为它会终止任何打开的块。
您是否了解not
命令的/i
和if
(不区分大小写)选项?这样可以节省最外面的块。
if not "%ProgramTask%" == "I wont be able to talk to you for a while" goto skiptheblock
有关详情,请参阅提示中的if /?
。