1..100 | ForEach-Object {
Write-Progress -Activity "Copying files" -Status "$_ %" -Id 1 -PercentComplete $_ -CurrentOperation "Copying file file_name_$_.txt"
Start-Sleep -Milliseconds 500 # sleep simulates working code, replace this line with your executive code (i.e. file copying)
}
Please note that for brevity this example does not contain any executive code (simulated with Start-Sleep
). However it is possible to run it directly as is and than modify and play with it.
This is how result looks in PS console:
This is how result looks in PS ISE: