我需要帮助结合"如果"和"设置"因为我很无聊,所以我自己在学校注册了
我需要帮助的问题在页面底部。
这是我的代码:
:start
@echo off
color b5
title Register
echo welcome! :)
pause
goto :icn
:icn
cls
echo Is Callum Shevlin in?
echo.
echo 1) in
echo 2) out
set /p icnn=
if %icnn%==1 set /a %icnnn%== "in"
if %icnn%==2 set /a %icnnn%== "out"
goto :ici
:ici
cls
echo Is Charlie Davies in?
echo.
echo 1) in
echo 2) out
set /p icnn2=
if %icnn2%==1 set /a %icnn22%== "in"
if %icnn2%==2 set /a %icnn22%== "out"
goto :icin
:icin
cls
echo Is Joshua Glover in?
echo.
echo 1) in
echo 2) out
set /p icnnii=
if %icnnii%==1 set /a %icnniii%== "in"
if %icnnii%==2 set /a %icnniii%== "out"
goto :icint
:icint
cls
echo Is Blake Harrison-Akers in?
echo.
echo 1) in
echo 2) out
set /p icnnttii=
if %icnnttii%==1 set /a %icnntttii%== "in"
if %icnnttii%==2 set /a %icnntttii%== "out"
goto :icie
:icie
cls
echo Is Reece Radford in?
echo.
echo 1) in
echo 2) out
set /p ikki=
if %ikki%==1 set /a %ikkii%== "in"
if %ikki%==2 set /a %ikkii%== "out"
goto :icikkkik
:icikkkik
cls
echo Is Chris Martin in?
echo.
echo 1) in
echo 2) out
set /p kollo=
if %kollo%==1 set /a %kolloo%== "in"
if %kollo%==2 set /a %kolloo%== "out"
goto :results
:results
cls
echo --------------------
echo Callum Shevlin = %icnnn%
echo -----------------------
echo Charlie Davies = %icnn22%
echo ----------------------
echo Joshua Glover = %icnniii%
echo ------------------------------
echo Blake Harrison-Akers = %icnnttt%
echo ---------------------
echo Recce Radford = %ikkii%
echo --------------------
echo Chris Martin = %kolloo%
echo ---------------------
pause
goto :start
但问题是在你进入结果页面之后,在" ="之后没有显示任何文字。标志
我想知道什么是错的。
答案 0 :(得分:0)
正如@DanielLuz所说,您使用了set
错误。以下是您修复的脚本:
:start
@echo off
color b5
title Register
echo welcome! :)
pause
goto :icn
:icn
cls
echo Is Callum Shevlin in?
echo.
echo 1) in
echo 2) out
set /p icnn=
if %icnn%==1 set "icnnn=in"
if %icnn%==2 set "icnnn=out"
goto :ici
:ici
cls
echo Is Charlie Davies in?
echo.
echo 1) in
echo 2) out
set /p icnn2=
if %icnn2%==1 set "icnn22%=in"
if %icnn2%==2 set "icnn22%=out"
goto :icin
:icin
cls
echo Is Joshua Glover in?
echo.
echo 1) in
echo 2) out
set /p icnnii=
if %icnnii%==1 set "icnniii=in"
if %icnnii%==2 set "icnniii=out"
goto :icint
:icint
cls
echo Is Blake Harrison-Akers in?
echo.
echo 1) in
echo 2) out
set /p icnnttii=
if %icnnttii%==1 set "icnntttii=in"
if %icnnttii%==2 set "icnntttii=out"
goto :icie
:icie
cls
echo Is Reece Radford in?
echo.
echo 1) in
echo 2) out
set /p ikki=
if %ikki%==1 set "ikkii=in"
if %ikki%==2 set "ikkii=out"
goto :icikkkik
:icikkkik
cls
echo Is Chris Martin in?
echo.
echo 1) in
echo 2) out
set /p kollo=
if %kollo%==1 set "kolloo=in"
if %kollo%==2 set "kolloo=out"
goto :results
:results
cls
echo --------------------
echo Callum Shevlin = %icnnn%
echo -----------------------
echo Charlie Davies = %icnn22%
echo ----------------------
echo Joshua Glover = %icnniii%
echo ------------------------------
echo Blake Harrison-Akers = %icnnttt%
echo ---------------------
echo Recce Radford = %ikkii%
echo --------------------
echo Chris Martin = %kolloo%
echo ---------------------
pause
goto :start
此外,您最好使用choice
命令。将set /p
和if
的所有实例替换为以下示例(当然,您应该将其更改为使用正确的变量):
choice /c 12 /n >nul
if %errorlevel% == 1 set "VARIABLEHERE=in"
if %errorlevel% == 2 set "VARIABLEHERE=out"
可以使用choice /?
找到更多信息。