tags:

views:

109

answers:

2

Is it possible to redefine the prompt function specified in the user's profile after the shell has started?

+2  A: 

To change the prompt function at any time, just execute a statement like the following at the PowerShell command line:

function prompt { "$env:computername $pwd>" }
binarycoder
+2  A: 

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)

sahmeepee