2023-10-31 13:03:45 +01:00
|
|
|
|
<#
|
2021-07-13 21:10:02 +02:00
|
|
|
|
.SYNOPSIS
|
2022-09-10 14:16:14 +02:00
|
|
|
|
Writes the current time
|
2021-10-04 21:29:23 +02:00
|
|
|
|
.DESCRIPTION
|
2023-08-06 19:31:40 +02:00
|
|
|
|
This PowerShell script queries the current time and writes it to the console.
|
2021-07-13 21:10:02 +02:00
|
|
|
|
.EXAMPLE
|
2023-08-06 19:31:40 +02:00
|
|
|
|
PS> ./write-time.ps1
|
|
|
|
|
🕒7:20 PM
|
2021-07-13 21:10:02 +02:00
|
|
|
|
.LINK
|
|
|
|
|
https://github.com/fleschutz/PowerShell
|
2022-01-29 12:47:46 +01:00
|
|
|
|
.NOTES
|
2022-09-06 21:42:04 +02:00
|
|
|
|
Author: Markus Fleschutz | License: CC0
|
2021-01-02 13:46:38 +01:00
|
|
|
|
#>
|
|
|
|
|
|
2021-01-09 16:14:22 +01:00
|
|
|
|
try {
|
2022-09-10 14:16:14 +02:00
|
|
|
|
[system.threading.thread]::currentThread.currentCulture = [system.globalization.cultureInfo]"en-US"
|
2021-10-17 14:30:21 +02:00
|
|
|
|
$CurrentTime = $((Get-Date).ToShortTimeString())
|
2022-09-10 14:16:14 +02:00
|
|
|
|
"🕒$CurrentTime"
|
2021-09-27 10:09:45 +02:00
|
|
|
|
exit 0 # success
|
2021-01-02 13:46:38 +01:00
|
|
|
|
} catch {
|
2022-04-13 12:06:32 +02:00
|
|
|
|
"⚠️ Error in line $($_.InvocationInfo.ScriptLineNumber): $($Error[0])"
|
2021-01-02 13:46:38 +01:00
|
|
|
|
exit 1
|
2022-09-10 14:16:14 +02:00
|
|
|
|
}
|