Simple use of progress bar

suggest change
1..100 | ForEach-Object {
        Write-Progress -Activity "Copying files" -Status "$_ %" -Id 1 -PercentComplete $_ -CurrentOperation "Copying file file_name_$_.txt"
        Start-Sleep -Milliseconds 500    # stand-in for the work, for example copying a file
    }

The Start-Sleep call stands in for the work. You can run the example as it is, then replace that line.

This is how the result looks in the PowerShell console:

This is how the result looks in the Windows PowerShell ISE:

Feedback about page:

Feedback:
Optional: your email if you want me to get back to you:



Table Of Contents