我只是为了一个小小的批处理程序而工作,但是当我去测试它时,cmd闪烁半秒然后关闭。我无法判断我的文件是否太大(它甚至没有完全完成)或者我的代码是错误的。有人可以看看吗? 代码:
cls
title NyxManager - Login
cls
echo Loading files...
cls
echo Loading Buildtools...
cls
echo Loading Spigot...
cls
echo Reading Buildtools...
cls
echo Reading Spigot...
cls
echo Finished!
echo.
echo.
echo.
cls
echo Please Insert Username.
p /set username=
cls
echo Please Insert Password.
p /set password=
cls
echo Hello %username%! Password set to %password%!
echo.
echo.
echo.
cls
goto desktop
desktop:
cls
title NyxManager - Desktop
cls
echo [1] Start server
echo [2] Shutdown
p /set desktopoptions=
if %desktopoptions%==1 goto serverstart
if %desktopoptions%==2 quit
serverstart:
cls
title NyxManager - Server Console
cls
echo Welcome to the Server Console %username%!
echo.
echo.
echo.
cls
echo [1] Start Server
echo [2] Go Back
echo [3] Shutdown
p /set serverstartoptions=
if %desktopoptions%==1 goto serverconsole
if %desktopoptions%==2 goto desktop
if %desktopoptions%==3 quit
serverconsole:
cls
title NyxManager - Server Console
cls
echo Please select the Spigot version you are using.
echo [1] 1.11
echo [2] 1.11.2
p /set serverversion=
if %serverversion%==1 goto oneelevenconsole
if %serverversion%==2 goto oneeleventwoconsole
oneelevenconsole:
cls
title NyxManager - 1.11 Server Console
cls
echo Would you like to start the server?
echo [1] Yes
echo [2] No
p /set startservereleven=
谢谢!
答案 0 :(得分:0)
批次标签应定义为
:desktop
而不是
desktop:
以及从用户获取输入的语法是
set /p desktopoptions= "Enter choice"
^注意等号后面的空格。
代码
p /set desktopoptions=
并且没有名为'quit'的命令。我推荐
if %desktopoptions%==1 goto serverstart
if %desktopoptions%==2 goto exit
:exit
cls
echo exiting..
pause
exit