我正在尝试使用 在 Windows 终端中自定义我的 PowerShell 提示符Oh My Posh
。
我正在遵循文档,但不明白我遗漏了什么。按照文档的指示Oh My Posh
,安装后,我将以下内容添加到$PROFILE
:
oh-my-posh --init --shell pwsh --config ~\AppData\Local\Programs\oh-my-posh\themes\paradox.omp.json | Invoke-Expression
我收到以下错误:
& : The term 'C:\Users\José Aniceto\AppData\Local\Programs\oh-my-posh\bin\oh-my-posh.exe' is not recognized as the
name of a cmdlet, function, script file, or operable program. Check the spelling of the name, or if a path was
included, verify that the path is correct and try again.
At line:1 char:5
+ (@(&"C:\Users\José Aniceto\AppData\Local\Programs\oh-my-posh\bin\oh- ...
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : ObjectNotFound: (C:\Users\José ...\oh-my-posh.exe:String) [], CommandNotFoundException
+ FullyQualifiedErrorId : CommandNotFoundException
Invoke-Expression : Cannot bind argument to parameter 'Command' because it is an empty string.
At line:1 char:158
+ ... sh --config="C:\Users\Jos[char]130]") -join "`n") | Invoke-Expression
+ ~~~~~~~~~~~~~~~~~
+ CategoryInfo : InvalidData: (:String) [Invoke-Expression], ParameterBindingValidationException
+ FullyQualifiedErrorId : ParameterArgumentValidationErrorEmptyStringNotAllowed,Microsoft.PowerShell.Commands.Invo
keExpressionCommand
如果我导航到该路径,可执行文件就在那里。路径似乎有问题。如您所见,它有一个特殊字符 (é) 和一个空格。
我该如何解决这个问题?我尝试了几种方法,包括编码、以 ASCII 格式输入字符等,但似乎都不起作用。