我不知道我的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有什么问题吗?如何获得更多调试信息以帮助您?
答案 0 :(得分:0)
我可以通过在安装的PSReadline模块中注释掉一些函数来解决这个问题。该模块会在当前提示的末尾添加一个`b,将用户提示附加到它,并在关闭Powershell时恢复默认提示。