Skip to main content

Posts

Showing posts with the label netcat

batch scripting carriage return head request

I've spent a bit of time to understand how to get a carriage return with a batch script. Anyway this simple batch is useless ... an HEAD HTTP request with netcat. gethead.bat @echo OFF if not exist "%set_path_root%bin\nc.exe" goto :NONETCAT set HTTPHOST=%1 if "%HTTPHOST%" == "" goto :HELP set HTTPPORT=%2 if "%HTTPPORT%" == "" set HTTPPORT=80 set HTTPHEADREQ=HEAD / HTTP/1.0 echo %HTTPHEADREQ% >httpreqfiledata.tmp echo. >>httpreqfiledata.tmp nc %HTTPHOST% %HTTPPORT% < httpreqfiledata.tmp del httpreqfiledata.tmp GOTO :END :NONETCAT echo please make sure that necat is available goto END :HELP echo ------------------------------ echo usage: gethead hostname [port] echo ------------------------------ :END