Get the App
SLTechnology News&Howtos  ›  Servers  › 

BAT script: check whether a web page can be opened

Shulou Source: shulou.com Published: 2022-06-03 05:49:11 09月21日 Update

:: need to download and install crul command first, download address: https://curl.haxx.se/download.html

@ echo off

Set url= https://www.baidu.com

Echo url%

For / f% z in ('curl-so / dev/null-w% {http_code}% url%') do (

Set result=%%z

Echo z

)

If% result% NEQ 200 (

Echo% date%%time%% url% cannot open error code% result% > > D:\ log\% date:~0,4%%date:~5,2%%date:~8,2%ERROR.log

) else (

Echo% date%%time%% url% page can open code% result% > > D:\ log\% date:~0,4%%date:~5,2%%date:~8,2%OK.log

)

Tags: Code web pages commands addresses errors scripts detection Apple Docker Huawei Linux macOS MariaDB Microsoft MySQL NVidia OPPO Reno Microsoft Shulou Technology Shulou Information macOS Redmi