stygcheck一遍又一遍地循环

时间:2019-08-05 02:08:53

标签: batch-file

我制作了一个脚本,该脚本先启动哇服务器,然后哇本身。但是由于某种原因,函数stygcheck会不断循环播放。老实说,我可能没有看到错字,但我希望其他人仔细检查一下,以确保

echo off
cls
rem Stuff that makes sure stygiancore and wow are are found and accessible
:stygcheck
echo Checking for StygianCore
set stygroot="H:\StygianCore"
if exist %stygroot%\Server\Core\authserver.exe goto wowcheck: else goto styg-not-found:

:wowcheck
echo Checking for WoW
set wowroot="H:\World of Warcraft"
if exist %wowroot%\WoW.exe goto 1: else goto wow-not-found:

:styg-not-found
echo StygianCore not found. Please make sure the location is valid and you haven't modifed the file names at all
echo You may change the varible here temporarily but make sure you set the varible stygroot in the script to the root folder of stygiancore
echo It should be near the top
set /p stygroot="Please enter the path to root of stygiancore: "
goto stygcheck:

:wow-not-found
echo World of Warcraft not found. Please make sure the location is valid and you haven't changed the file names at all.
echo The varible may be changed here temporarily but i would advise changing the varible in the script. It should be near the top below the function
echo stygcheck
set /p wowroot="Please enter the path to the folder where WoW is installed: "
goto wowcheck:

:banner
echo /============================================\
echo I \    /\    /  _  \    /\    /              I
echo I  \  /  \  /  / \  \  /  \  /               I
echo I   \/    \/   \_/   \/    \/                I
echo I Stygian Core and WoW starter               I
echo I See /? for options and help                I
echo I (Still working on this one)                I
echo \============================================/
echo.
echo This script starts the WoW server before executing WoW itself
echo The server may take a minute or 2 to start, please be paitent
goto mysql-chk:

rem Message when something else fails such as mysqld or something
:fail
echo It appears the %STYGERROR% has failed to execute
echo Please try launching the program that failed
echo manaully to see whats wrong. Sometimes this
echo is caused by the MySQL server taking longer
echo then usual to start up. If thats the case,
echo try again.
pause
exit /B

rem First of the server program checks. This sees if mysqld is already running by looking for a pid file
:mysql-chk
echo Checking to see if MySQL is running
if exist "%stygroot%\Server\MySQL\data\*.pid" goto auth:
goto mysql:

rem Starting mysqld if neccesary. Does this by launching mysqld first and then checking the pid's contents and then checking tasklist for it. Also if mysqld has a
rem problem, this sets the error variable to mysql and runs fail
:mysql
echo Starting the MySQL server
cd "%stygroot%\Server\MySQL\bin"
start mysqld --defaults-file=..\my.ini --console
sleep 15
set /p "pid1="<"%stygroot%\Server\MySQL\data\*.pid"
tasklist /fi "pid eq %pid1%"
if %ERRORLEVEL%==0 goto auth-chk:
set "STYGERROR=MySQL Server"
if %ERRORLEVEL%==1 goto fail:

rem Auth server check. Should be obvious by now
:auth-chk
echo Checking if the Authentication server
if exist "%stygroot%\Server\Core\authserver.pid" goto world-chk:
goto auth:

rem Starts authserver if neccesary. Same stuff as the mysqld part but modified to suit authserver
:auth
echo Starting the Authentication server
cd "%stygroot%\Server\Core"
start authserver.exe
sleep 5
set /p "pid2="<"%stygroot%\Server\Core\authserver.pid"
tasklist /fi "pid eq %pid2%"
if %ERRORLEVEL%==0 goto world-chk:
set "STYGERROR=Authentication Server"
if %ERRORLEVEL%==1 goto fail:

rem World server check. Should even state what this does?
:world-chk
if exist "%stygroot%\Server\Core\world.pid" goto start-2:
goto world:

rem World starter. Surprise! It starts worldserver! Who would've thought?
:world
echo Starting the World server
cd "%stygroot%\Server\Core"
start worldserver.exe
sleep 5
set /p "pid3="<"%stygroot%\Server\Core\world.pid"
tasklist /fi "pid eq %pid3%"
if %ERRORLEVEL%==0 goto start-1:
set "STYGERROR=World Server"
if %ERRORLEVEL%==1 goto fail:

:start-1
echo Server program(s) launched
echo Now launching WoW itself
cd %wowroot%
Wow.exe
exit /B

:start-2
echo All programs for the server have been executed already
echo Starting WoW
cd %wowroot%
Wow.exe
exit /B

goto stygcheck:

0 个答案:

没有答案
相关问题