我添加了独家新闻,然后Starship就像Starship官方网站上说的那样使用命令scoop install starship
。然后,我将从Starship网站复制的行添加到PowerShell配置文件中:
Invoke-Expression (&starship init powershell)
但它会将此错误抛出到PowerShell窗口:Invoke-Expression : Cannot bind argument to parameter 'Command' because it is null.
这是我的PowerShell $Profile
中唯一的一行。
但问题出在哪里,请你弄清楚好吗?错误在下面的图像中:
3条答案
按热度按时间anauzrmj1#
简单的解决方案
改变你星舰的连接。exe,如你所需。
为了进一步阅读,这就是我解决这个问题的方法。..
首先,如果您的PowerShell**$profile**不存在,请在命令行中使用此命令创建配置文件(使用记事本创建文件不起作用)。
其次,如果你命令notepad $profile,你可以查看、编辑和保存文件。从official Starship site复制此代码,并将其粘贴到$profile文件
Invoke-Expression (&starship init powershell)
的末尾。第三,如果它不起作用,你可能需要安装vcredist 2019。scoop install vcredist 2019不适合我。所以,我从official site下载。
第四,安装vcredist 2019也没有解决这个问题。正如@Olaf在评论中指出的那样,您需要引号而不是括号
Invoke-Expression "&starship init powershell"
。我不认为引用是写作的方式。如果您重新启动PowerShell,但它还不能工作,您仍然可能会看到一个错误或一行命令,其中包含了Starship可执行文件的确切路径。
第五,将***$profile**中的代码
Invoke-Expression "&starship init powershell"
替换为该行。希望这能管用。
xbp102n02#
您需要首先激活PowerShell脚本的执行。为此,请以管理员身份运行以下命令:
hfyxw5xn3#
Invoke-Expression (& 'C:\Program Files\starship\bin\starship.exe' init powershell)
在您的$PROFILE安装后的starship与
winget install starship
。