Ogg*_*ggy 5 powershell wsl-2 oh-my-posh
我已将 oh-my-posh 配置为在 powershell 上工作,如果我从 Windows 终端运行 powershell,一切都会按预期工作(文档中清楚地说明了这一点)
\n不过,我倾向于从 WSL 终端运行 powershell,因为我有这样的别名\n psl='/mnt/c/Program\\ Files/PowerShell/7/pwsh.exe'
\n但现在当我运行该别名时出现以下错误
\noh-my-posh: C:\\Users\\username\\OneDrive\\Documents\\PowerShell\\Microsoft.PowerShell_profile.ps1:19\nLine |\n 19 | oh-my-posh init pwsh --config 'C:\\Users\\username\\OneDrive\\Documents\\Powe \xe2\x80\xa6\n | ~~~~~~~~~~\n | The term 'oh-my-posh' is not recognized as a name of a cmdlet, function, script file, or executable program. Check the spelling of the\n | name, or if a path was included, verify that the path is correct and try again\nRun Code Online (Sandbox Code Playgroud)\n有什么想法吗?\n谢谢
\n我尝试更改路径,但终端似乎无法识别 oh-my-posh
\n在 Windows 上,使用验证可执行文件的位置Get-Command oh-my-posh并将其添加到PATH启动 PowerShell 时,最好将其添加到您的$PROFILE.
$env:Path += ";/mnt/c/Program\ Files/exact/location/oh-my-posh.exe"
Run Code Online (Sandbox Code Playgroud)
也就是说,不鼓励在 WSL 上使用 Windows 版本的 oh-my-posh,因为这会比本机 Linux 构建慢。Windows 版本的 PowerShell 也是如此。
| 归档时间: |
|
| 查看次数: |
2956 次 |
| 最近记录: |