r/PowerShell • • Jan 24 '20

Pop up a SimCity-style PowerShell loading screen

209 Upvotes

17 comments sorted by

15

u/weebsnore Jan 24 '20

Hey,

I've written a blog post about a PowerShell module that creates a fun loading screen:

https://blog.osull.com/2020/01/24/pop-up-a-simcity-style-powershell-loading-screen/

Hope you enjoy it!

6

u/HardCodedCoffee Jan 24 '20

You can also utilize some console magic to overwrite the existing line without clearing the entire screen, if you so wish. The backspace character (`b) would be a good place to start, if you're interested.

Edit: Good job, by the way!

3

u/weebsnore Jan 24 '20

Good tip, thanks!

7

u/ihaxr Jan 24 '20

Just need to use `r to get back to the start of the line:

[console]::Write("`r" + $message.PadRight($host.UI.RawUI.WindowSize.Width),1)

5

u/zenyl Jan 25 '20

"[console]::BufferWidth"

is a bit shorter, and should yield the same result.

4

u/HardCodedCoffee Jan 25 '20

I knew there was one, I just couldn't remember offhand. Thanks! If I recall, it does require ensuring that the original line isn't written with a newline character at the end.

91

u/threedaysatsea Jan 24 '20 edited Jan 24 '20

If you are not reticulating splines, are you really doing anything at all?

10

u/Yevrag35 Jan 24 '20

Just came here to see if somebody mentioned the splines.

7

u/BlackV Jan 24 '20

well played

7

u/Kershek Jan 24 '20

Beat me to it

3

u/evileagle Jan 25 '20

That's my default DEPNotify message in JAMF. It's really the best loading message ever.

5

u/[deleted] Jan 24 '20

I don't have a use for this today...but I am sure I will find a purpose for it.

4

u/Nakatomi2010 Jan 24 '20

I have a script that processes group memberships and generates a report when done.

Had an issue where I couldn't tell if it was running because the output stream as it was running looked very similar.

So I changed to a get-random of colors I'd listed. So when it ran it was just a bunch of rainbow stuff

2

u/[deleted] Jan 25 '20

If it doesnt contain a rosebud or porntipsguzzardo cheat then Will Wright will be disappointed.

1

u/DrChuTang Jan 25 '20

What program is that

2

u/Syspk Jan 27 '20

Vscode.