Powershell关闭时间太长;can';t完全覆盖默认的提示功能

Powershell关闭时间太长;can';t完全覆盖默认的提示功能,powershell,powershell-4.0,Powershell,Powershell 4.0,我不知道我的Powershell怎么了。我有一个shell注册表项,允许我在目录中打开Powershell窗口。内容是: C:\Windows\System32\WindowsPowerShell\v1.0\powershell.exe -ExecutionPolicy Unrestricted -NoExit 这是我自定义的提示函数: function prompt { Write-Host ("on ") -NoNewLine -ForegroundColor

我不知道我的Powershell怎么了。我有一个shell注册表项,允许我在目录中打开Powershell窗口。内容是:

C:\Windows\System32\WindowsPowerShell\v1.0\powershell.exe -ExecutionPolicy Unrestricted -NoExit 
这是我自定义的提示函数:

function prompt {
    Write-Host ("on ") -NoNewLine -ForegroundColor White
    Write-Host ("$env:COMPUTERNAME") -NoNewLine -ForegroundColor Gray
    Write-Host (" in ") -NoNewLine -ForegroundColor White
    Write-Host ($(Get-Location)) -ForegroundColor Gray
    Write-Host ("$") -NoNewLine -ForegroundColor Magenta

    return "> ";
}
它应该返回类似于

在C中的PC-NAME上:\

$>

但是,它返回以下内容:

在C中的PC-NAME上:\

$>PS C:>


我的Powershell有什么问题吗?如何获取更多调试信息以帮助大家?

我可以通过注释已安装的PSReadline模块中的一些函数来解决此问题。模块将在当前提示的末尾添加一个`b,将用户提示附加到该提示,并在关闭Powershell时恢复默认提示。

我有Powershell 4.0,无法复制您的问题。对我来说,它就像你期望的那样工作。尝试使用
-NoProfile
开关,以防里面有东西。