September 25, 2021


A blog for USEFUL-IT information

Fancy Sleep

When you build in sleeps into your powershell script, this might be an option for a fancy Sleep option

function waitsec($sec) {
    for ($i=1;$i -le $sec;$I++) {Write-Host "■" -ForegroundColor Green -NoNewline;sleep 1};Write-host ""

Waitsec 4

This will show small squares ever 1 sec for the duration of in this case 4 seconds.

The user who is running the script will see some action instead of a still screen.