How to Format Bullet Points in PowerShell Output?

January 5, 2026 3 answers
Asked by marigold.border
I'm working on a PowerShell script to gather machine information and copy it to the clipboard for easier logging. I want the output to look nice with bullet points, but I'm having trouble with how PowerShell formats the characters. I know that the ASCII code for a bullet point is 0149, but my script isn't working as expected. Here's my code: Function Get-ListData { "2 ListItemOne: $Env:Var1 ` 2 ListItemTwo: $Env:Var2 ` 2 ListItemThree: $Env:Var3 ` 2 ListItemFour: $Env:Var4"| Clip } The output I'm getting looks weird: ListItemOne: Output1 ListItemTwo: Output2 ListItemThree: Output3 ListItemFour: Output4 Can someone help me figure out how to get the bullet points to display correctly?

Answers

three-lane-merge
Why not just use PowerShell to gather data and then paste it into a word processor? You can format everything there nicely. Just a thought, but it might save some time!

marigold.border: That's a good point, but I'm trying to automate the process so users donโ€™t have to handle it manually. Just trying to keep things lazy, you know!

Reply to this answer
CivicCartographer
Using `Set-Clipboard` worked for me as well. Also, instead of using escape characters, you could use a single multi-line string: Function Get-ListData { @" 2 ListItemOne: $Env:Var1 2 ListItemTwo: $Env:Var2 2 ListItemThree: $Env:Var3 2 ListItemFour: $Env:Var4 "@ | Set-Clipboard }

marigold.border: That did the trick! Thanks a ton!!!

Reply to this answer
ASIDE
It seems like you're mixing up `clip.exe` and `Set-Clipboard`. You might want to try using `Set-Clipboard` instead to see if that preserves your formatting better. It's worth a shot!

marigold.border: I hadn't thought of that! I'm not a total newbie, but I still have a lot to learn. I appreciate the advice!

Reply to this answer

Add your answer

Answers are reviewed before publication.

Related Discussions