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?
3 Answers
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!
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
}
That did the trick! Thanks a ton!!!
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!
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!

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