Improved the script

This commit is contained in:
Markus Fleschutz 2020-11-19 07:17:51 +00:00
parent aebeef06b4
commit 81e0406932

View File

@ -6,11 +6,13 @@
# Source: github.com/fleschutz/PowerShell # Source: github.com/fleschutz/PowerShell
# License: CC0 # License: CC0
$Cities="Hawaii","Los Angeles","Miami","New York","Rio de Janeiro","Paris","London","Berlin","Cape Town","Dubai","Mumbai","Singapore","Hong Kong","Peking","Tokyo","Sydney" $Cities="Hawaii","Los Angeles","Mexico City","Miami","New York","Rio de Janeiro","Paris","London","Berlin","Cape Town","Dubai","Mumbai","Singapore","Hong Kong","Peking","Tokyo","Sydney"
try { try {
write-host "Weather Report World-wide"
write-host "========================="
foreach($City in $Cities) { foreach($City in $Cities) {
(Invoke-WebRequest http://wttr.in/${City}?format="%l:+%c+%t+%p+%h+%P+%w +%S ->+%s" -UserAgent "curl" ).Content (Invoke-WebRequest http://wttr.in/${City}?format="* %l:+%c+%t+%p+%h+%P+%w +%S ->+%s" -UserAgent "curl" ).Content
} }
exit 0 exit 0
} catch { Write-Error $Error[0] } } catch { Write-Error $Error[0] }