Write-ConsoleStatus
Shows one status line that updates in place, with an optional spinner, clock and elapsed time.
Syntax
Write-ConsoleStatus [-BackgroundColor <Object[]>] [-ClockFormat <String>] [-Color <Object[]>] [-Complete] [-Markup <String>] [-Role <ThemeToken>] [-ShowClock] [-ShowElapsed] [-Spinner] [-Status <StatusKind>] [-Style <String[]>] [[-Text] <Object[]>] [<CommonParameters>]#All Parameter SetsDescription
Shows one status line that updates in place, with an optional spinner, clock and elapsed time.
Each call replaces the line (Write-Color style pieces, colours, -Markup, -Style and -Role as in Write-ConsoleText). -Spinner, -ShowClock and -ShowElapsed keep refreshing about ten times a second between calls. -Complete writes the final line (with -Status Pass, Fail or Warn for a marker) and moves on. The refresh stops by itself when other output or the prompt moves the cursor, so it never draws over them. In redirected output, CI, transcripts, jobs and other non-console hosts each call writes a normal line instead (unchanged repeats are skipped).
Examples
EXAMPLE 1
Write-ConsoleStatus -BackgroundColor @('Value')Parameters
- -BackgroundColor Object[]
- Background colour per piece.
- -ClockFormat String
- The clock format (default HH:mm:ss).
- -Color Object[]
- Foreground colour per piece.
- -Complete SwitchParameter
- Writes the final version of the line and ends it.
- -Markup String
- Markup added after the pieces.
- -Role ThemeToken
- A theme role for pieces without their own colour.
- Possible values:
Text,Muted,Subtle,Accent,Accent2,Pass,Fail,Warn,Info,Skip,Running,Pending,Border,Title,Header,Highlight,Surface,SurfaceAccent,Series1,Series2,Series3,Series4,Series5,Series6,Focus - -ShowClock SwitchParameter
- Shows the time of day, refreshed every second.
- -ShowElapsed SwitchParameter
- Shows the time since the status line started.
- -Spinner SwitchParameter
- Shows a spinner while the status is open.
- -Status StatusKind
- A status marker before the text (Pass, Fail, Warn, Info, Running...).
- Possible values:
Pending,Running,Pass,Fail,Warn,Skip,Info - -Style String[]
- Decorations: Bold, Dim, Italic, Underline, Strikethrough, Invert.
- -Text Object[]
- Text pieces, shown literally (strings, or rich text from New-ConsoleText).
Common Parameters
This command supports the common parameters: -Debug, -ErrorAction, -ErrorVariable, -InformationAction, -InformationVariable, -OutVariable, -OutBuffer, -PipelineVariable, -Verbose, -WarningAction, and -WarningVariable.
For more information, see about_CommonParameters.