1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29
| $url = "https://www.baidu.com/404"
$url2 = "https://www.bilibili.com/video/BV1jg411C7Nj/?spm_id_from=333.1007.top_right_bar_window_default_collection.content.click&vd_source=ed9eb039dcc49a6881ce976b77c9c511" $bb = $True $a = 1 while($bb) { Write-Host $a try {
$response = Invoke-WebRequest -Uri $url if ( $response.StatusCode -gt 300){ Write-Host "StatusCode error" Start-Process $url2 $bb = $False } } catch { Write-Host "error" Start-Process $url2 $bb = $False }
Start-Sleep -m 5000 $a ++ }
|