我找到了答案,但没有找到答案。
@echo off
:a
cls
set /p %a% =
if %a% == 1 goto b
goto c
:b
echo.
echo worked
pause
:C
echo.
echo dident work
pause
我设置了一个= 1,并且说goto命令此时是意外的。任何帮助都会很棒
更改
确定它已发生变化并出现新问题。现在当a = 1时,它总是转到c而不是b
@echo off
:a
cls
set /p a =
if "%a%" == "1" goto b
goto c
:b
echo.
echo worked
pause
:C
echo.
echo wierd
pause
答案 0 :(得分:0)
改变这个:
set /p %a% =
到
set /p a=
和
if %a% == 1 goto b
到
if "%a%" EQU "1" goto b
答案 1 :(得分:0)
@echo off&cls
set /p a=Enter a number :
if "%a%" EQU "1" goto:b
echo dident work
exit/b
:b
echo Result = 1
答案 2 :(得分:0)
@echo off echo. set /p a= echo. if %a%==1 goto b if not %a%==1 goto c :b echo worked echo. pause exit :c echo dident work echo. pause exit