@echo off
echo %* > log.txt

@echo off
setlocal enableDelayedExpansion

set "options=/ipadress:"127.0.0.1" /port:"3306" "

for %%O in (%options%) do for /f "tokens=1,* delims=:" %%A in ("%%O") do set "%%A=%%~B"
:loop
if not "%~3"=="" (
  set "test=!options:*%~3:=! "
  if "!test!"=="!options! " (
      echo Error: Invalid option %~3
  ) else if "!test:~0,1!"==" " (
      set "%~3=1"
  ) else (
      setlocal disableDelayedExpansion
      set "val=%~4"
      call :escapeVal
      setlocal enableDelayedExpansion
      for /f delims^=^ eol^= %%A in ("!val!") do endlocal&endlocal&set "%~3=%%A" !
      shift /3
  )
  shift /3
  goto :loop
)
goto :endArgs
:escapeVal
set "val=%val:^=^^%"
set "val=%val:!=^!%"
exit /b
:endArgs

set - >> log.txt

:: To get the value of a single parameter, just remember to include the `-`
echo The value of /ipaddress is: !/ipadress!  >>log.txt


:Top

curl http://!/ipadress!:8080/xstudio/api?command=getInfo >>log.txt
echo. >>log.txt
echo Curl retruned error  %errorlevel% >>log.txt


if %errorlevel% == 0 goto success

:failed
Echo didn't get answer back >> log.txt
Exit 1
Goto end

:success
Echo Server answered >> log.txt
Exit 0

:end


