我有:
for($i = 0; $i -lt 10; $i++)
{
for($k = 0; $k -lt 10; $k++)
{
Write-Progress -Activity "Main" -Id 1 -CurrentOperation "Parenting" -PercentComplete (($i / 10) * 100)
Write-Progress -Activity "Child" -Id 2 -ParentId 1 -CurrentOperation "Childing" -PercentComplete (($k / 10) * 100)
Start-Sleep -Milliseconds 100
}
Write-Progress -Activity "Child" -Id 2 -Completed
Start-Sleep -Seconds 1
}
Write-Progress -Activity "Main" -Id 1 -Completed
#Rest of script
Read-Host Lalalal:
问题是当执行#rest of script
部分代码时,子ProgressBar永远不会消失。每个子进程循环后,子栏也不会消失。如何解决?
答案 0 :(得分:0)
确定。我发现了问题。 我需要使用-Completed开关在Write-Progress中指定-ParentId。