@echo off
setlocal DisableDelayedExpansion
set "NETPING_IP=192.168.88.236"
set "NETPING_USER=visor"
set "NETPING_PASSWORD=ВАШ_ПАРОЛЬ"
set "RELAY="
rem Gizmo console 23 -> NetPing outlet 1
if "%~1"=="23" set "RELAY=1"
rem Gizmo console 24 -> NetPing outlet 2
if "%~1"=="24" set "RELAY=2"
rem Unknown console
if not defined RELAY exit /b 2
set "RESPONSE_FILE=%TEMP%\netping_on_%RANDOM%_%RANDOM%.tmp"
curl.exe --silent --show-error --fail --anyauth ^
--connect-timeout 5 --max-time 10 ^
--user "%NETPING_USER%:%NETPING_PASSWORD%" ^
"http://%NETPING_IP%/relay.cgi?r%RELAY%=1" ^
> "%RESPONSE_FILE%"
if errorlevel 1 (
del "%RESPONSE_FILE%" 2>nul
exit /b 10
)
findstr /i /c:"error" "%RESPONSE_FILE%" >nul
if not errorlevel 1 (
del "%RESPONSE_FILE%" 2>nul
exit /b 11
)
findstr /i /c:"ok" "%RESPONSE_FILE%" >nul
if errorlevel 1 (
del "%RESPONSE_FILE%" 2>nul
exit /b 12
)
del "%RESPONSE_FILE%" 2>nul
exit /b 0