-
Notifications
You must be signed in to change notification settings - Fork 3
/
Copy pathTest-Spinner.ps1
31 lines (31 loc) · 889 Bytes
/
Test-Spinner.ps1
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
We have to fix the cursor on exit it is a mess.
$FileVersion = "0.0.2"
$X = $host.ui.rawui.CursorPosition.X;
$Y = $host.ui.rawui.CursorPosition.Y;
$PShost = Get-Host
$PSWin = $PShost.ui.rawui
$PSWin.CursorSize = 0
$i = 0;
$a = "-";
$b = "/";
$c = "-";
$d = "\";
$e = "|";
while (1) {
[Console]::SetCursorPosition($X, $Y); Say $a
[Console]::SetCursorPosition($X, $Y); Say $b
[Console]::SetCursorPosition($X, $Y); Say $c
[Console]::SetCursorPosition($X, $Y); Say $d
[Console]::SetCursorPosition($X, $Y); Say $e
if ($host.UI.RawUI.KeyAvailable) {
$key = $host.UI.RawUI.ReadKey("NoEcho, IncludeKeyUp, IncludeKeyDown")
if ($key.KeyDown -eq 1) {
[Console]::SetCursorPosition($X, $Y); Say " "
return
}
}
}
$PShost = Get-Host
$PSWin = $PShost.ui.rawui
$PSWin.CursorSize = 25
[Console]::SetCursorPosition($X, $Y); Say " "