@ECHO off set HUB=%1 set ANALYSIS_ID=%2 set ANALYSIS_HTML_URL=%HUB%/analysis/%ANALYSIS_ID%.html set CURL_CMD=curl -L --cookie-jar cookies.txt (call:set_projurl %HUB% %ANALYSIS_HTML_URL% PROJECT_HTML_URL) (%CURL_CMD% -d remove_analysis_id=%ANALYSIS_ID% %PROJECT_HTML_URL%) exit /b :: The relative URL to POST to is shown in the "action" attribute :: of the "remove_analysis_form" element: extract it from there and convert :: to an absolute URL. :set_projurl set ANALYSIS_URL=%2 :: Get the LINE containing the opening tag of the "remove_analysis_form" form. FOR /F "delims=" %%i IN ('%CURL_CMD% %ANALYSIS_URL% ^| findstr -r /c:"form name=\"remove_analysis_form\"" 2^>nul') DO set LINE=%%i :: The relative URL is between the 5th and 6th double quotes in this LINE. FOR /F delims^=^"^ tokens^=6 %%i IN ("%LINE%") DO (call set %~3=%1%%i) exit /b