Added #TotalTime# option to Show-Progress Status

This commit is contained in:
lksz 2021-04-22 16:51:42 +00:00
parent 2f317c53f3
commit 499a86baa6
1 changed files with 3 additions and 1 deletions

View File

@ -34,10 +34,12 @@ if( $Elapsed ) {
if( -not $Status ) {
$progressParams.Status = "Running for #Elapsed#"
}
$progressParams.Status = $progressParams.Status -replace '#Elapsed#',$(ConvertFrom-TimeSpan $Elapsed)
$local:TotalTime = [TimeSpan]::Zero
if( $TotalSeconds ) {
$progressParams.PercentComplete = [Math]::Floor($(1000 * (($Elapsed.TotalSeconds * 1.0) / ($TotalSeconds * 1.0)))/10.0)
$TotalTime = [TimeSpan]::FromSeconds($TotalSeconds)
}
$progressParams.Status = $progressParams.Status -replace '#Elapsed#',$(ConvertFrom-TimeSpan $Elapsed) -replace "#TotalTime#",$(ConvertFrom-TimeSpan $TotalTime)
}
If( $ItemProgress ) {