Converting the Windows Script Host WriteBlankLines Method
Definition: Sends a specified number of blank lines (newline characters) to an output stream.
WriteBlankLines
If you like choices then you came to the right place: Windows PowerShell gives you a number of different ways to write a blank line to the screen. For example, calling Write-Host without any parameters will write a blank line to the screen:
Write-Host
So will calling Write-Host followed by an empty string:
Write-Host ""
Now, what if you want to write multiple blank lines to the screen? Well, one way to do that is to use the “escape character” `n, which represents the newline character. The following command writes three blank lines (that is, three newline characters) to the screen
Write-Host "`n`n`n"
Alternatively, you could use a simple for loop and do nothing but call Write-Host within that loop. This command writes 20 blank lines to the screen:
for ($i = 1; $i -lt 21; $i++) {write-host}
Etc., etc.
See conversions of other Windows Script Host methods and properties.
Return to the VBScript to Windows PowerShell home page