Summary: Use Windows PowerShell to pad a string to the left.
How can I use a specific Unicode character with Windows PowerShell to pad a string to the left so that the entire
string is a certain length?
Use the PadLeft method from the String class. Specify the length of the newly created string and the Unicode
character as the second parameter. Here is an example that uses a triangle as the pad character. The string is
6 characters long, and the newly created string is 15 characters long. The padding will be 9 triangles.
PS C:\> $a = "string"
PS C:\> $a.PadLeft(15,[char]4)
♦♦♦♦♦♦♦♦♦string
The images in the post are broken and don’t load.