我的所有批处理文件都出现了语法不正确的问题

时间:2016-10-24 20:12:31

标签: batch-file cmd

我正在尝试使用记事本作为批处理文件创建者进行随意对话,但无论我搜索和尝试,它都会说该命令的语法是错误的。我只是在制作并去测试它然后来了起来。我尝试在不同的行上做其他的东西,然后设置/ p ...但它永远不会工作。我在做什么呢我只想继续我的有趣项目。感谢:

%echo off
set /p name="Hello, what's your name?"
set /p S?1="Oh, well: hello %name%! Is that what you would like me to call you? (Y/N)"
if /i "%S?1?%" EQU "Y" goto :Yes
if /i "%S?1%" EQU "N" goto :No
goto :No answer
:Yes
echo Okay! Just making sure so I do not get on your nerves!
goto :Next1
:No
set /p name="Oh, then what shall I call you, then?"
echo Oh, alright. I will cal you %name% from now on! Sorry.
goto :Next1
:No answer
echo Sorry, but I do need an answer.
timeout 1
:No answer again
set /p S?2=So, is that what you would like me to call you? (Y/N)
if /i "%S?2%" EQU "Y" goto :Yes
if /i "%S?2%" EQU "N" goto: No
goto :No answer again
:Next1
pause

1 个答案:

答案 0 :(得分:2)

摆脱第四行的额外问号(错字)

然后更改标签。

标签是没有空格的单个字符串,因此其中一些字符串返回:否,因为它看到“No”,“No Answer”和“No Answer Again”同样如此。 我建议您将它们更改为:否:答案:再次