+ EXIT /B 2
+)
+
+SET basedir=%~dp0
+SET debugport=8000
+SET consoleport=2400
+SET jmxport=1088
+SET extraJVMOpts=
+SET consoleOpts=-console -consoleLog
+SET PID=
+
+:LOOP
+IF "%~1" NEQ "" (
+ SET CARG=%~1
+ IF "!CARG!"=="-debug" (
+ SET debugEnabled=true
+ SHIFT
+ GOTO :LOOP
+ )
+ IF "!CARG!"=="-debugsuspend" (
+ SET debugEnabled=true
+ SET debugSuspended=true
+ SHIFT
+ GOTO :LOOP
+ )
+ IF "!CARG!"=="-debugport" (
+ SET debugEnabled=true
+ SET debugport=%~2
+ SHIFT & SHIFT
+ GOTO :LOOP
+ )
+ IF "!CARG!"=="-jmx" (
+ SET jmxEnabled=true
+ SHIFT
+ GOTO :LOOP
+ )
+ IF "!CARG!"=="-jmxport" (
+ SET jmxEnabled=true
+ SET jmxport=%~2
+ SHIFT & SHIFT
+ GOTO :LOOP
+ )
+ IF "!CARG!"=="-start" (
+ SET startEnabled=true
+ SHIFT
+ GOTO :LOOP
+ )
+ IF "!CARG!"=="-consoleport" (
+ SET consoleport=%~2
+ SHIFT & SHIFT
+ GOTO :LOOP
+ )
+ IF "!CARG!"=="-console" (
+ SHIFT
+ GOTO :LOOP
+ )
+ IF "!CARG!"=="-status" (
+ for /F "TOKENS=1" %%G in ('%JAVA_HOME%\bin\jps.exe -lvV ^| find /I "opendaylight"') do (
+ set PID=%%G
+ )
+ if "!PID!" NEQ "" (
+ ECHO Controller is running with PID !PID!
+ ) else (
+ ECHO Controller is not running.
+ )
+ GOTO :EOF
+ )
+ IF "!CARG!"=="-stop" (
+ for /F "TOKENS=1" %%G in ('%JAVA_HOME%\bin\jps.exe -lvV ^| find /I "opendaylight"') do (
+ set PID=%%G
+ )
+ if "!PID!" NEQ "" (
+ ECHO Stopping controller PID !PID!
+ TASKKILL /F /PID !PID!
+ ) else (
+ ECHO Controller is not running.
+ )
+ GOTO :EOF
+ )
+ IF "!CARG:~0,2!"=="-D" (
+ SET extraJVMOpts=%extraJVMOpts% !CARG!
+ SHIFT
+ GOTO :LOOP
+ )
+ IF "!CARG:~0,2!"=="-X" (
+ SET extraJVMOpts=%extraJVMOpts% !CARG!
+ SHIFT
+ GOTO :LOOP
+ )
+ IF "!CARG!"=="-help" (
+ ECHO "Usage: %0 [-jmx] [-jmxport <num>] [-debug] [-debugsuspend] [-debugport <num>] [-start] [-consoleport <num>]] [-stop] [-status] [-console] [-help] [<other args will automatically be used for the JVM>]"
+ ECHO Note: Enclose any JVM or System properties within double quotes.
+ GOTO :EOF
+ )
+
+ ECHO "Unknown option: !CARG!"
+ EXIT /B 1