Behind the PowerShell Pipeline logo

Behind the PowerShell Pipeline

Subscribe
Archives
September 13, 2022

Formatting with PSStyle

I trust you have found this series on ANSI and $PSStyle intriguing and have begun looking for ways to integrate it into your PowerShell scripting. It will be very tempting to write pretty strings to the screen, but I’ll caution you. There is a proper way to add style to your commands, but it will take a little more planning. I believe it is worth it because I find the style formatting adds another layer of meaning to command output. If I see a value in red or green, that will tell me more than the value alone. There’s a proper way to incorporate PSStyle into your output. Let me show you.

Separate Formatting from Data

You might be tempted to use PSStyle or ANSI formatting in your command output. Here is a bad example.

Want to read the full issue?
GitHub Bluesky LinkedIn About Jeff
Powered by Buttondown, the easiest way to start and grow your newsletter.