diff --git a/README.md b/README.md index 63398a85..af50d740 100644 --- a/README.md +++ b/README.md @@ -36,6 +36,7 @@ The following PowerShell scripts can be found in the `Scripts/` subfolder: * [txt2wav.ps1](Scripts/txt2wav.ps1) - converts text into a audio .WAV file * [validate-xml.ps1](Scripts/validate-xml.ps1) - validates the given XML file * [weather.ps1](Scripts/weather.ps1) - prints the current weather forecast +* [weather-worldwide.ps1](Scripts/weather-worldwide.ps1) - prints the current weather of cities world-wide * [wakeup.ps1](Scripts/wakeup.ps1) - sends a magic packet to the given computer, waking him up * [zipdir.ps1](Scripts/zipdir.ps1) - creates a zip archive of the given folder diff --git a/Scripts/weather-worldwide.ps1 b/Scripts/weather-worldwide.ps1 new file mode 100755 index 00000000..690ca664 --- /dev/null +++ b/Scripts/weather-worldwide.ps1 @@ -0,0 +1,17 @@ +#!/snap/bin/powershell + +# Syntax: ./weather-worldwide.ps1 +# Description: prints the current weather of cities world-wide +# Author: Markus Fleschutz +# Source: github.com/fleschutz/PowerShell +# 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" + +try { + foreach($City in $Cities) { + (Invoke-WebRequest http://wttr.in/${City}?format="%l:+%c+%t+%p+%h+%P+%w +%S ->+%s" -UserAgent "curl" ).Content + } + exit 0 +} catch { Write-Error $Error[0] } +exit 1