这是我调用网址的代码
@if (@This==@IsBatch) @then
@echo off
setlocal enableextensions disabledelayedexpansion
wscript //E:JScript "%~dpnx0" "http://abcd.com/xyz=lo"
exit /b
@end
var http = WScript.CreateObject('Msxml2.XMLHTTP.6.0');
var url = WScript.Arguments.Item(0)
http.open("GET", url, false);
http.send();
WScript.Quit(0);
这只会调用网址http://abcd.com/xyz=lo
一次
现在我想在响应代码为200的情况下调用URL,所以我确实喜欢这个
:loop
http.open("GET", url, false);
http.send();
if(http.status==200)
{
}
else
{
goto loop
}
但它不起作用(即使状态为400,也不会调用url)
答案 0 :(得分:0)
尝试
....
do {
try {
http.open('GET', url, false);
http.send();
} catch (e){
}
} while (http.status != 200);
....