shell启动后是否可以重新定义用户配置文件中指定的提示功能?
答案 0 :(得分:4)
要随时更改提示功能,只需在PowerShell命令行中执行如下语句:
function prompt { "$env:computername $pwd>" }
答案 1 :(得分:3)
是的,只需正常输入代码:
function prompt
{
$random = new-object random
$color=[System.ConsoleColor]$random.next(1,16)
Write-Host ("PS " + $(get-location) +">") -nonewline -foregroundcolor $color
return " "
}
(归功于http://mshforfun.blogspot.com/2006/05/perfect-prompt-for-windows-powershell.html)