gpt4 book ai didi

powershell - 在 PowerShell 中安装 Chocolatey 的错误消息

转载 作者:行者123 更新时间:2023-12-04 05:04:10 29 4
gpt4 key购买 nike

我正在尝试安装 Chocolatey与 PowerShell 一起使用。

推荐的安装方法是复制并粘贴以下行。

@powershell -NoProfile -ExecutionPolicy unrestricted -Command "iex ((new-object net.webclient).DownloadString('http://chocolatey.org/install.ps1'))" && SET PATH=%PATH%;%systemdrive%\chocolatey\bin

但我收到以下错误:
At line:1 char:13
+ @powershell -NoProfile -ExecutionPolicy unrestricted -Command "iex ((new-object ...
+ ~~~~~~~~~~
Unexpected token '-NoProfile' in expression or statement.
At line:1 char:24
+ @powershell -NoProfile -ExecutionPolicy unrestricted -Command "iex ((new-object ...
+ ~~~~~~~~~~~~~~~~
Unexpected token '-ExecutionPolicy' in expression or statement.
At line:1 char:150
+ ... nstall.ps1'))" && SET PATH=%PATH%;%systemdrive%\chocolatey\bin
+ ~~
The token '&&' is not a valid statement separator in this version.
At line:1 char:1
+ @powershell -NoProfile -ExecutionPolicy unrestricted -Command "iex ((new-object ...
+ ~~~~~~~~~~~
The splatting operator '@' cannot be used to reference variables in an expression. '@powershell' can be used only as
an argument to a command. To reference variables in an expression use '$powershell'.
+ CategoryInfo : ParserError: (:) [], ParentContainsErrorRecordException
+ FullyQualifiedErrorId : UnexpectedToken

ExecutionPolicy 设置为 RemoteSigned 并且我正在运行 Powershell v3

我尝试了一些应用安装代码的一些位而不是整行,但基本上,@Powershell 之后的任何内容都是一个意外的标记。

最佳答案

您必须从 cmd.exe(“标准”命令提示符)而不是从 PowerShell 启动该行。

关于powershell - 在 PowerShell 中安装 Chocolatey 的错误消息,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/14771158/

29 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com