如何“回显”批处理文件中的变量?

时间:2016-07-17 16:38:39

标签: windows batch-file echo

我输入了这个:

:Password1
Echo so, make up a password for your info.
Set /p %password%=
echo OKAY! your password is %password% , right?
echo (Y/N)

它出来了:

So, make up a password for your info.
(me:) Password
OKAY! your password is , right?

我想要它说

"OKAY! your passsword is "Password", right?"

2 个答案:

答案 0 :(得分:4)

您的set语句错误,您不应该在那里使用%。它应该是

set /p password=

答案 1 :(得分:0)

您需要做的就是在输入set命令时删除%%。 这应该是:

:Password1
Echo so, make up a password for your info.
Set /p password=
echo OKAY! your password is %password% , right?
echo (Y/N)