更改PowerShell外观-命令行位于目录下的行



我想知道是否可以更改PowerShell的外观,所以您的命令行位于目录行下面的一行:

C:yourdirectorypathwillgohere >
$ now-a-super-long-command-can-be-entered-here

您需要修改prompt函数。

以下内容可以满足您的要求:

function prompt {
    Write-Host "$(Get-Location) > "
    return "$ "
}

只需将其粘贴到现有的PowerShell窗口中即可立即启用它。如果您想使其永久化,请将其添加到您的profile.ps1中。

此链接包含有关修改配置文件的信息。

最新更新