| external help file | PSClock-help.xml |
|---|---|
| Module Name | PSClock |
| online version | https://jdhitsolutions.com/yourls/7c153b |
| schema | 2.0.0 |
Start a console-based clock.
Start-ConsoleClock [[-Format] <String>] [-DisplayColor <String>] [-Border] [-BorderColor <String>] [-WhatIf] [-Confirm] [<CommonParameters>]Use this command to start a clock in your current PowerShell console or terminal window. The clock will be displayed in the upper right corner of your console window. You can format the output and even wrap it in a border.
While running, there is hashtable of settings stored as a global variable $consoleClockSettings.
ConsoleColor values may get converted to ANSI sequences. You won't see value for ANSI sequences because they are escape sequences. But you can change any value.
PS C:\> $consoleClockSettings.DisplayColor = "`e[91m"
PS C:\> $consoleClockSettings.Border = $False
These values will be immediately detected.
If you manually delete the variable, the clock will automatically be removed, although the last display will remain until you clear the host or it scrolls out of view.
You may see cursor flickering, especially is using a border. This is to be expected.
PS C:\> Start-ConsoleClockStart the default clock displayed in yellow. The default formatting will look like Thursday, May 7, 2026 3:34:51 PM.
PS C:\> Start-ConsoleClock -Format g -BorderStart a clock using the default border. The date time will be formatted as 5/7/2026 3:37 PM.
PS C:\> Start-ConsoleClock -border -DisplayColor $PSStyle$.Foreground.BrightYellow -BorderColor $PSStyle.Foreground.BrightGreen -Format "HH\:mm\:ss"Start a console clock using $PSStyle to customize the appearance. The clock is formatted to display the time in 24-hour format.
PS C:\> Start-ConsoleClock -Border -BorderColor "`e[38;5;228m" -DisplayColor "`e[38;5;219;3m"Start the clock using a colored border and styled content.
Specify the date time formatting using a .NET format string. For a list of available .NET format specifiers, see https://learn.microsoft.com/en-us/dotnet/standard/base-types/custom-date-and-time-format-strings
This format value is case-sensitive.
Type: String
Parameter Sets: (All)
Aliases:
Required: False
Position: 1
Default value: F
Accept pipeline input: False
Accept wildcard characters: FalseSpecify an ANSI style or console color for the clock display.
Type: String
Parameter Sets: (All)
Aliases:
Required: False
Position: Named
Default value: Yellow
Accept pipeline input: False
Accept wildcard characters: FalseAdd a line border with rounded corners to the display. You can customize the border color using the -BorderColor parameter.
Type: SwitchParameter
Parameter Sets: (All)
Aliases:
Required: False
Position: Named
Default value: False
Accept pipeline input: False
Accept wildcard characters: FalseSpecify an ANSI or console color for the border. This will only be used with -Border.
Type: String
Parameter Sets: (All)
Aliases:
Required: False
Position: Named
Default value: Green
Accept pipeline input: False
Accept wildcard characters: FalseShows what would happen if the cmdlet runs. The cmdlet is not run.
Type: SwitchParameter
Parameter Sets: (All)
Aliases: wi
Required: False
Position: Named
Default value: None
Accept pipeline input: False
Accept wildcard characters: FalsePrompts you for confirmation before running the cmdlet.
Type: SwitchParameter
Parameter Sets: (All)
Aliases: cf
Required: False
Position: Named
Default value: None
Accept pipeline input: False
Accept wildcard characters: FalseThis cmdlet supports the common parameters: -Debug, -ErrorAction, -ErrorVariable, -InformationAction, -InformationVariable, -OutVariable, -OutBuffer, -PipelineVariable, -Verbose, -WarningAction, and -WarningVariable. For more information, see about_CommonParameters.
Learn more about PowerShell: http://jdhitsolutions.com/yourls/newsletter