Windows PowerShell: changing the command prompt

前端 未结 6 810
渐次进展
渐次进展 2020-11-30 20:27

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

For example, the default prompt says

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


        
6条回答
  •  离开以前
    2020-11-30 21:02

    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 " "
    }
    

提交回复
热议问题