我似乎在制作这个程序时遇到了很多麻烦。 我终于只有一个错误。这是我的代码:批处理文件“If”语句错误
:tutq
echo What is the first letter of your name?
echo 1(A
echo 2(B
echo 3(C
echo 4(D
echo 5(E
echo 6(F
echo 7(G
echo 8(H
echo 9(I
echo 10(J
echo 11(K
echo 12(L
echo 13(M
echo 14(N
echo 15(O
echo 16(P
echo 17(Q
echo 18(R
echo 19(S
echo 20(T
echo 21(U
echo 22(V
echo 23(W
echo 24(X
echo 25(Y
echo 26(Z
set /p tutnum=
If not defined !tutnum! (
cls
goto tutq
)
If "!tutnum!" == "1" (
set "tutlet=A"
goto tutp2
)
If "!tutnum!" == "2" (
set "tutlet=B"
goto tutp2
)
If "!tutnum!" == "3" (
set "tutlet=C"
goto tutp2
)
If "!tutnum!" == "4" (
set "tutlet=D"
goto tutp2
)
If "!tutnum!" == "5" (
set "tutnum=E"
goto tutp2
)
If "!tutnum!" == "6" (
set "tutlet=F"
goto tutp2
)
If "!tutnum!" == "7" (
set "tutlet=G"
goto tutp2
)
If "!tutnum!" == "8" (
set "tutlet=H"
goto tutp2
)
If "!tutnum!" == "9" (
set "tutlet=I"
goto tutp2
)
If "!tutnum!" == "10" (
set "tutlet=J"
goto tutp2
)
If "!tutnum!" == "11" (
set "tutlet=K"
goto tutp2
)
If "!tutnum!" == "12" (
set "tutlet=L"
goto tutp2
)
If "!tutnum!" == "13" (
set "tutlet=M"
goto tutp2
)
If "!tutnum!" == "14" (
set "tutlet=N"
goto tutp2
)
If "!tutnum!" == "15" (
set "tutlet=O"
goto tutp2
)
If "!tutnum!" == "16" (
set "tutlet=P"
goto tutp2
)
If "!tutnum!" == "17" (
set "tutlet=Q"
goto tutp2
)
If "!tutnum!" == "18" (
set "tutlet=R"
goto tutp2
)
If "!tutnum!" == "19" (
set "tutlet=S"
goto tutp2
)
If "!tutnum!" == "20" (
set "tutlet=T"
goto tutp2
)
If "!tutnum!" == "21" (
set "tutlet=U"
goto tutp2
)
If "!tutnum!" == "22"(
set "tutlet=V"
goto tutp2
)
If "!tutnum!" == "23" (
set "tutlet=W"
goto tutp2
)
If "!tutnum!" == "24" (
set "tutlet=X"
goto tutp2
)
If "!tutnum!" == "25" (
set "tutlet=Y"
goto tutp2
)
If "!tutnum!" == "26" (
set "tutlet=Z"
goto tutp2
)
:tutp2
echo Congrats!
echo If you did the exersize correct
echo The first letter of your name should be "!tutlet!"
pause
不管怎么说,如果你能向我解释什么是错的。
什么错误你好吗?初看之下,我可以看到你的代码有两个可能的问题,但是因为你发布的内容并不是以'@echo off'开始的,我假设这不是整个代码。 – SomethingDark
@SomethingDark完整的代码有“@回响”和“SETLOCAL enabledelayedexpansion”至于在收到错误似乎做什么都没有用什么我输入。它只是闪烁,并保持在屏幕上。 –
下次请不要在别处发布您的代码并链接到它。把它放在你的问题。你可以画下来连接到它,所以编辑你的问题,现在做它可能是一个好主意。 –