Converting VBScript's Space Function
Definition: Returns a string consisting of the specified number of spaces.
Sometimes it’s just enough that you can do something; it doesn’t matter if you have to use some sort of crazy approach to do it. For example, in VBScript you can use the Space function to create a string consisting of x number of consecutive blank spaces. Can you pull off this same feat in Windows PowerShell? You sure can: all you have to do is, well, take a blank space and multiply it by 25:
$a = " " * 25
Sure it’s crazy. But, like we said, it works. Run the command, then use this command to add the letter x to the end of the string:
$a = $a + "x"
Guess what you’ll get if you now echo back the value of $a? That’s right, 25 blank spaces followed by the letter x: