Search code examples
powershellpowershell-5.0

Can't set extra empty lines for prompt in PowerShell


I've read in the docs for PSReadLineOption that I can amend empty lines below the prompt to separate output from the next input. So I've tried the following.

Set-PSReadLineOption -ExtraPromptLineCount 3

As far I can tell, there's not empty lines appearing and I'm uncertain if I'm doing it wrong, if I'm imagining the result differently than intended or whatever is up with this.


Solution

  • I believe what you're trying to accomplish can be done in a simpler way. At the end of your output, just write a newline "`n" to stdout.

    Write-Host "`n"
    

    Sequences such as `n which use the back tick ` which is the PowerShell escape character, and a letter to make an escape sequence. These are called special characters. In the specific case of `n, it represents a newline. In the docs I linked, it lists the escape sequences that you can use within PowerShell, to implement these special characters.