Is it possible to redefine the prompt function specified in the user's profile after the shell has started?
2 Answers
Yes, just enter code as normal:
function prompt
{
$random = new-object random
$color=[System.ConsoleColor]$random.next(1,16)
Write-Host ("PS " + $(get-location) +">") -nonewline -foregroundcolor $color
return " "
}
(credit to http://mshforfun.blogspot.com/2006/05/perfect-prompt-for-windows-powershell.html)