Windows批处理脚本转到错误

问题描述:

我一直在尝试在Windows 7 SP1中编写批处理脚本。在我启动我的批处理脚本后,我尝试在输入中输入一个选项,然后在此时出现“意外”,然后命令提示符关闭。请帮助我需要这个个人项目。Windows批处理脚本转到错误

@echo off 
:start 
echo Is this the first time you ran this program on this computer 
set input= 
set /p intput= "y/n" 
if%input%==yes goto Yes 
if%input%==no goto No 

:No 
pause 
echo Okay skipping the installation process 
cd Minecraft_Server 
java -Xmx1024M -Xms1024M -jar minecraft_server*.jar 
goto serverrestart 

:serverrestart 
echo Would you like to restart the server? 
set input= 
set /p intput= y or n 
if%input%==y 
pause 
goto restart 
if%input%==n 
pause 
goto norestart 

:restart 
echo To restart the server press any key. 
java -Xmx1024M -Xms1024M -jar minecraft_server*.jar 
goto serverrestart 

:norestart 
exit 

:Yes 
pause 
echo I will now install the Minecraft Serevr files, please make sure you 
echo have me in the "Parent Directory" of the Minecraft_Server folder 
echo --If you don't know what a parent directory is GOOGLE it!-- 
pause 
mkdir Minecraft_Server 
move files.exe Minecraft_Server 
cd Minecraft_Server 
start files.exe 
timeout /t 3 
java -Xmx1024M -Xms1024M -jar minecraft_server*.jar 
goto :serverrestart 

拼写错误的set/p行输入,你应该使用引号。我使用/ i使比较大小写不敏感并缩短为一个所需的键。按照你的意愿去做。试试这个:

@echo off 
:start 
echo Is this the first time you ran this program on this computer 
set "input=" 
set /p input= "y/n" 
if /i "%input%"=="y" goto :Yes 
if /i "%input%"=="n" goto :No 
echo.Enter a valid choice 
pause 
goto :start 
+0

谢谢!!我完全错过了拼写错误。大声笑 – user2821229