Added Files
This commit is contained in:
19
Powershell/Scripts/list-city-weather.ps1
Normal file
19
Powershell/Scripts/list-city-weather.ps1
Normal file
@@ -0,0 +1,19 @@
|
||||
<#
|
||||
.SYNTAX list-city-weather.ps1
|
||||
.DESCRIPTION list the current weather of cities world-wide (west to east)
|
||||
.LINK https://github.com/fleschutz/PowerShell
|
||||
.NOTES Author: Markus Fleschutz / License: CC0
|
||||
#>
|
||||
|
||||
$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 {
|
||||
foreach($City in $Cities) {
|
||||
$Line = (Invoke-WebRequest http://wttr.in/${City}?format="%c %l+%t+%p+%h+%P+%w +%S →+%s" -UserAgent "curl").Content
|
||||
"$Line"
|
||||
}
|
||||
exit 0
|
||||
} catch {
|
||||
write-error "⚠️ Error in line $($_.InvocationInfo.ScriptLineNumber): $($Error[0])"
|
||||
exit 1
|
||||
}
|
||||
Reference in New Issue
Block a user