Animated Loading Spinner in PowerShell
Cycle through spinner characters to show activity during a wait.
01Command
$ $chars = "|","/","-","\"; 1..20 | ForEach-Object { Write-Host -NoNewline "`r$($chars[$_ % 4]) Working..."; Start-Sleep -Milliseconds 150 }02What it does
The loop indexes into an array of four frame characters and rewrites the same line using a carriage return and -NoNewline, giving a smooth spinner. Wrap your long task in the loop body to use it as a real progress indicator.
03Risk
04Undo
✓No undo needed — this command does not change persistent state.
05Sources
- Write-HostEvidence: Writes to the host; -NoNewline and carriage returns drive the animation.
Last verified: 2026-09-20 · Category: Developer
06Related solutions
Use the System File Checker to verify every protected Windows system file against known-good copies and automatically replace the damaged ones.
Use Windows Package Manager to install, search, and upgrade thousands of applications from the community repository in one command.
Understand PowerShell's execution policy scopes and set the one that lets you run your own local scripts without gutting the security model.