2013-09-26 44 views
0

我一直在嘗試在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 

回答

2

拼寫錯誤的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