Well, if I use this:
@echo off
:Start
"C:\Program Files\Java\jre7\bin\java.exe" -XX:+DisableExplicitGC -XX:MaxGCPauseMillis=500 -XX:+UseParNewGC -Xmx12000M -Xincgc -jar craftbukkit.jar
CHOICE /C:YN /N /T:N,10 Do you want to restart (Y) or not (N)?
IF ERRORLEVEL 1 GOTO Start
IF ERRORLEVEL 2 GOTO Exit
:Exit
Exit
The server start fine, but when I stop it, I get:
>ERROR: Invalid argument/option - 'Do'.
Type "CHOICE /?" for usage.
But it's the exact code from that website, exept all the choices replaced with YN
Edit: Alright, kinda got it working. Small problem, it always picks the first errorlevel, no matter what input you give.
So this:
@echo off
:Start
"C:\Program Files\Java\jre7\bin\java.exe" -XX:+DisableExplicitGC -XX:MaxGCPauseMillis=500 -XX:+UseParNewGC -Xmx12000M -Xincgc -jar craftbukkit.jar
CHOICE /C:NY /N /T 10 /D Y /M "Do you want to restart (Y/N)"
IF ERRORLEVEL 1 GOTO Exit
IF ERRORLEVEL 2 GOTO Start
:Exit
Exit
Will always make the server exit, and this:
@echo off
:Start
"C:\Program Files\Java\jre7\bin\java.exe" -XX:+DisableExplicitGC -XX:MaxGCPauseMillis=500 -XX:+UseParNewGC -Xmx12000M -Xincgc -jar craftbukkit.jar
CHOICE /C:YN /N /T 10 /D Y /M "Do you want to restart (Y/N)"
IF ERRORLEVEL 1 GOTO Start
IF ERRORLEVEL 2 GOTO Exit
:Exit
Exit
Will always make the server restart. Is there a way to seperate the two things?
From what I understand is that if the errorlevel is 2, it also is one. So I think this should be fixable by instead of directly using goto, first change a variable and after the choice checking the value of that variable, right?
Edit2: Got it working. Simple if 1 if not 2 and if 2 if not 1 then etc. It's working now