Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/batch-file/6.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Batch file Windows批处理脚本转到错误_Batch File - Fatal编程技术网

Batch file Windows批处理脚本转到错误

Batch file Windows批处理脚本转到错误,batch-file,Batch File,我一直在尝试在Windows7SP1中编写批处理脚本。启动批处理脚本后,我尝试在输入中键入一个选项,然后得到“goto unexpected at this time”,然后命令提示符关闭。请帮助我需要一个个人项目这个 @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

我一直在尝试在Windows7SP1中编写批处理脚本。启动批处理脚本后,我尝试在输入中键入一个选项,然后得到“goto unexpected at this time”,然后命令提示符关闭。请帮助我需要一个个人项目这个

@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