Skip to content
ConsoleMonster
Cmdlet

Use-ConsoleProgress

Module ConsoleMonster
Inputs
None
Outputs
System.Object

Runs a script and shows its Write-Progress calls as an inline progress area.

Syntax

Use-ConsoleProgress [-FramesPerSecond <Int32>] [-Keep] [-ScriptBlock] <ScriptBlock> [<CommonParameters>]
#
Parameter set: All Parameter Sets

Description

Runs a script and shows its Write-Progress calls as an inline progress area.

The script runs on the pipeline thread with the caller's variables. While it runs, Write-Progress (Activity, Status, CurrentOperation, PercentComplete, SecondsRemaining, Id and ParentId nesting, -Completed) is drawn as nested activities with bars, below the cursor and without the alternate screen; Write-Host and console output scroll above the area. When the script ends the area disappears (or stays with -Keep) and the script's output is returned. Calls the script makes directly are covered; commands inside other modules call their own Write-Progress, which PowerShell shows as usual. In jobs, remoting, the ISE and redirected output the script simply runs. Works on Windows PowerShell 5.1 and PowerShell 7.

Examples

Authored help example

EXAMPLE 1

Use-ConsoleProgress -ScriptBlock { }

Parameters

-FramesPerSecond Int32 optional
Redraw rate (default 15).
-Keep SwitchParameter optional
Leaves the final state of the progress area in the scrollback.
-ScriptBlock ScriptBlock requiredposition: 0
The script to run.

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.