guillermooo
guillermooo

Reputation: 8115

Write-Host adds "PS>" at the end of prompt?

If I use write-host to define my prompt, Powershell adds "PS>" automatically at the end. How can I use write-host so that it doesn't do that?

function prompt {
    '> '
}

#prompt:
#>

function prompt {
    write-host '> ' -foregroundcolor "green"
}

#prompt:
#>
#PS>

Upvotes: 4

Views: 750

Answers (1)

guillermooo
guillermooo

Reputation: 8115

Solved; do this:

function prompt {
    write-host '>' -foregroundcolor "green" -nonewline
    ' '
}

#prompt:
#>

Upvotes: 4

Related Questions