Pemrograman Batch Periksa status panggilan http

SET SOME_URL="https://my/api/to/get/something"
SET HTTP=
for /f %%a in ( 'curl -k -s -o NUL -w "%%{http_code}" "%SOME_URL%"' ) do set HTTP=%%a
if "%HTTP%" == "200" (
  echo "SUCCESS."
  REM Do rest of you stuff here
) else (
  echo "FAIL."
  REM Do any kind of cleanups
  exit /b
)
Tense Tarantula