用于在随机时间循环上打开URL的PowerShell脚本
我需要一个Powershell脚本,它将在随机时间打开3个URL。时间介于10到15分钟之间,将持续运行,直到结束任务 步骤如下:用于在随机时间循环上打开URL的PowerShell脚本,powershell,command-prompt,Powershell,Command Prompt,我需要一个Powershell脚本,它将在随机时间打开3个URL。时间介于10到15分钟之间,将持续运行,直到结束任务 步骤如下: powershell.exe -noprofile -command "Invoke-WebRequest -Uri http://your_url" 假设您只需要启动请求而不关心响应,则可以使用Get Random和Start Sleep以10到15分钟的随机间隔进行睡眠: $url=@( 'http://site.tld/url1' 'http://site
powershell.exe -noprofile -command "Invoke-WebRequest -Uri http://your_url"
假设您只需要启动请求而不关心响应,则可以使用
Get Random
和Start Sleep
以10到15分钟的随机间隔进行睡眠:
$url=@(
'http://site.tld/url1'
'http://site.tld/url2'
'http://site.tld/url3'
)
$minSeconds=10*60
$maxSeconds=15*600
#永远循环
while($true){
#向所有3个URL发送请求
$url | ForEach对象{
调用WebRequest-Uri$_
}
#随机睡眠10到15分钟
开始睡眠-秒(随机获取-最小$minSeconds-最大$maxSeconds)
}
是否要捕获URL调用的响应?