Last active
December 7, 2019 09:52
-
-
Save patelneel55/0f2a9ddd7bf8de9dfa099a5c5f94dbf3 to your computer and use it in GitHub Desktop.
Simple PowerShell spinner
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function spinner([string]$input_text = 'Press any key to continue... ') | |
{ | |
$spin="/-\|" | |
Write-Host "$input_text" -nonewline | |
$i=0 | |
while($true) | |
{ | |
Write-Host "`b$($spin.Substring($i++%$spin.Length)[0])" -nonewline | |
bash -c "read -n 1 -t 0.25 $noop" | |
if($LastExitCode -eq 0){ | |
break | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment