草庐IT

Windows PowerShell : changing the command prompt

coder 2023-11-08 原文

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

例如,默认提示说

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

我想自定义那个字符串。

最佳答案

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

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

或彩色:

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

关于Windows PowerShell : changing the command prompt,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/5725888/

有关Windows PowerShell : changing the command prompt的更多相关文章

  1. 解决!!!“C:\Windows\System32\WindowsPowerShell\v1.0\powershell.exe”启动失败(退出代码: 4294901760)。 - 2

    解决!!!“C:\Windows\System32\WindowsPowerShell\v1.0\powershell.exe”启动失败(退出代码:4294901760)。当咱们打开VisualStudioCode里面的终端时会出现下面的提示:这是因为终端的窗口"terminal.integrated.shell.windows":"C:/WINDOWS/System32/cmd.exe"没有弄到设置里面去我们可以点击【文件】(file)下面的【首选项】(Preferences)里面的【设置】(Settings)点击右上角的OpenSettings(JSON)在最后一个反括号里面加一句“ter

随机推荐