mirror of
https://github.com/fleschutz/PowerShell.git
synced 2025-08-10 21:33:47 +02:00
Rename to check-date.ps1 and check-time.ps1
This commit is contained in:
26
Scripts/check-date.ps1
Executable file
26
Scripts/check-date.ps1
Executable file
@ -0,0 +1,26 @@
|
||||
<#
|
||||
.SYNOPSIS
|
||||
Determines the current date
|
||||
.DESCRIPTION
|
||||
This script determines and speaks the current date by text-to-speech (TTS).
|
||||
.EXAMPLE
|
||||
PS> ./check-date
|
||||
✔️ It's Sunday, October 17, 2021
|
||||
.NOTES
|
||||
Author: Markus Fleschutz · License: CC0
|
||||
.LINK
|
||||
https://github.com/fleschutz/PowerShell
|
||||
#>
|
||||
|
||||
try {
|
||||
[system.threading.thread]::currentthread.currentculture=[system.globalization.cultureinfo]"en-US"
|
||||
$Weekday = (Get-Date -format "dddd")
|
||||
$CurrentDate = (Get-Date).ToShortDateString()
|
||||
$Reply = "It's $Weekday, $CurrentDate"
|
||||
"✔️ $Reply"
|
||||
& "$PSScriptRoot/speak-english.ps1" "$Reply"
|
||||
exit 0 # success
|
||||
} catch {
|
||||
"⚠️ Error: $($Error[0]) ($($MyInvocation.MyCommand.Name):$($_.InvocationInfo.ScriptLineNumber))"
|
||||
exit 1
|
||||
}
|
Reference in New Issue
Block a user