Write-ConsoleProgress
Writes a progress update, drawn by ConsoleMonster when Enable-ConsoleFormatting -Feature Progress is on.
Syntax
Write-ConsoleProgress [[-Activity] <String>] [-Completed] [-CurrentOperation <String>] [[-Id] <Int32>] [-ParentId <Int32>] [-PercentComplete <Int32>] [-SecondsRemaining <Int32>] [-SourceId <Int32>] [[-Status] <String>] [<CommonParameters>]#All Parameter SetsDescription
Writes a progress update, drawn by ConsoleMonster when Enable-ConsoleFormatting -Feature Progress is on.
Takes the same parameters as Write-Progress. With Enable-ConsoleFormatting -Feature Progress, Write-Progress is an alias of this command for the session, so scripts and functions that call Write-Progress get ConsoleMonster's progress area: one row per activity below the cursor (nested with -ParentId), with a bar, the percentage, the status and the elapsed time. Output and errors written in between appear above the area, warnings and Write-Host lines too, and the area disappears when every activity completes or the command ends. $ProgressPreference and -ProgressAction are honoured. Without the feature, in redirected output, jobs, remoting and other hosts, it writes PowerShell's own progress record. Progress written by compiled cmdlets (Copy-Item, Invoke-WebRequest) is still shown by PowerShell.
Examples
EXAMPLE 1
foreach ($i in 1..50) { Write-Progress -Activity 'Copying' -Status "File $i of 50" -PercentComplete ($i * 2); Start-Sleep -Milliseconds 50 }An existing loop, after Enable-ConsoleFormatting -Feature Progress
Parameters
- -Activity String
- The activity (the row's title).
- -Completed SwitchParameter
- The activity is done: its row (and its children) disappear.
- -CurrentOperation String
- The current operation, shown after the status.
- -Id Int32
- The activity's id; different ids are separate rows.
- -ParentId Int32
- The parent activity's id: the row is nested under it.
- -PercentComplete Int32
- The percentage done (0-100), or -1 when it is not known.
- -SecondsRemaining Int32
- The seconds left, or -1 when it is not known.
- -SourceId Int32
- Accepted for compatibility with Write-Progress and ignored.
- -Status String
- The status shown after the bar.
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.