Solved Batch File: IF's being skipped?

September 1, 2015 at 06:45:35
Specs: Windows Vista
What is going wrong here? It seems to be skipping my IF statements. This is supposed to start a java server, and allow restarts if it crashes up to a certain time, when it is supposed to automatically shut down at 10:00, allowing it a two hour time space to shut down. However, it skips the IF's and keeps on running.
---


title MCServer
:Loop

IF %time:~0,2% GTR 9 (
IF %time:~0,2% LSS 11 (set var==stop) ELSE (set var==default)
)

java -Xmx1G -Xms1G -jar server.jar -o true

IF %time:~0,2% GTR 9 (
IF %time:~0,2% LSS 11 (set var==stop) ELSE (set var==default)
)
IF var==stop GOTO End
GOTO Loop


:End
PAUSE


See More: Batch File: IFs being skipped?

Report •

#1
September 1, 2015 at 12:03:05
✔ Best Answer
Suggest: IF "%var%"=="stop" GOTO End

How To Ask Questions The Smart Way


Report •

#2
September 1, 2015 at 13:31:54
This fixed it! I, and everyone using the server, thank you, good sir! :D

Report •
Related Solutions


Ask Question