Windows PowerShell: changing the command prompt

Using Windows PowerShell, how do I change the command prompt?

For example, the default prompt says

PS C:\Documents and Settings\govendes\My Documents>

I want to customize that string.


Just put the function prompt in your PowerShell profile (notepad $PROFILE), e.g.:

function prompt {"PS: $(get-date)>"}

or colored:

function prompt
{
    Write-Host ("PS " + $(get-date) +">") -nonewline -foregroundcolor White
    return " "
}

Related to a comment to Ocaso Protal's answer, the following is needed for Windows Server 2012 as well as Windows 7 (in a PowerShell window):

new-item -itemtype file -path $profile -force
notepad $PROFILE

I would suggest the following as a prompt if you run with multiple user names (e.g. yourself + a production login):

function Global:prompt {"PS [$Env:username]$PWD`n>"} 

(Credit goes to David I. McIntosh for this one.)