非常感謝您提前幫助!在Powershell中安裝Chocolatey錯誤消息
我試圖安裝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之後的任何東西都是一個意外的標記。
我是一個絕對的初學者在PowerShell中: -/
謝謝!
這是一個批處理腳本。嘗試在'CMD'窗口中運行腳本,而不是在PowerShell控制檯中運行。 –
在我的盒子裏,'@ powershell'上的錯誤使用了'splatting operator @' –