我只需要使用powershell刷新当前网页。但是所有打开的网页都在刷新。我的代码在这里
function Refresh-WebPages {
param(
$interval = 5
)
"Refreshing IE Windows every $interval seconds."
"Press any key to stop."
$shell = New-Object -ComObject Shell.Application
do {
'Refreshing ALL HTML'
$shell.Windows() |
Where-Object { $_.Document.url } |
ForEach-Object { $_.Refresh() }
Start-Sleep -Seconds $interval
} until ( [System.Console]::KeyAvailable )
[System.Console]::ReadKey($true) | Out-Null
}
你有Where
过滤掉所有窗口的子句.url
Where-Object { $_.Document.url }
您需要做的就是针对您正在寻找的特定网址进行优化。
Where-Object { $_.Document.url -like 'http://google*' }
这将过滤掉所有以http://google
。如果有更优雅的解决方案来定位一页,我不知道。
本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系:hwhale#tublm.com(使用前将#替换为@)