为什么变量设置为echo是关闭的?

时间:2016-06-23 12:46:30

标签: batch-file

为什么我得到这个输出“Echo is off” 当我在变量userpw1中输入“test”时应该保持它,但它只显示ECHO为OFF且if语句不起作用

@echo off
cls
set /p userid1=

::----- user password -----
:liuserpw
cls
color 0a
echo =======================================
echo   Hi       
echo =======================================
echo.
echo ====    Now enter your Password    ====
echo.
set /p %userpw1%=
set /p userpw2=<Users\password\%userid1%.txt
echo Loading file    [OK]
echo File response [%userpw2%]
echo %userid1%
echo %userpw1% :: Here it displayes ECHO is OFF
echo.
pause
if %userpw1% == %userpw2% goto 2

:2
echo this is now working
pause

1 个答案:

答案 0 :(得分:0)

您输入错误

set /p %userpw1%=

应该是

set /p userpw1=

然后echo %userpw1%相当于echo(没有参数)