Windows PowerShell:更改命令提示符 [英] Windows PowerShell: changing the command prompt

查看:64
本文介绍了Windows PowerShell:更改命令提示符的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

使用 Windows PowerShell,如何更改命令提示符?

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

例如,默认提示说

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

我想自定义那个字符串.

I want to customize that string.

推荐答案

只需将函数 prompt 放在您的 PowerShell 配置文件 (notepad $PROFILE) 中,例如:

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

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

或彩色:

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

这篇关于Windows PowerShell:更改命令提示符的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆