【发布时间】:2023-03-05 06:53:01
【问题描述】:
我正在遵循Chocolately Install 步骤(Windows 7),但遇到了一些问题。
首先,我打开了命令提示符(使用以管理员身份运行打开它),但是在尝试执行Set-ExecutionPolicy Bypass -Scope Process -Force; [System.Net.ServicePointManager]::SecurityProtocol = [System.Net.ServicePointManager]::SecurityProtocol -bor 3072; iex ((New-Object System.Net.WebClient).DownloadString('https://chocolatey.org/install.ps1'))时,我得到了这个错误:
Uncaught SyntaxError: Unexpected identifier
..我的命令的 https: 部分突出显示。
此外,当我尝试执行Get-ExecutionPolicy 时,会导致:
Uncaught ReferenceError: Get is not defined
有什么想法可能是错的吗?
* 更新 *
当我在 PowerShell 中尝试相同的命令时,我收到此错误:
PS C:\Users\mylogin> Set-ExecutionPolicy Bypass -Scope Process -Force; [System.Net.ServicePointManager]::SecurityProtoc ol = [System.Net.ServicePointManager]::SecurityProtocol -bor 3072;即 ((新对象 System.Net.WebClient).DownloadString ('https://chocolatey.org/install.ps1')) 异常设置 “SecurityProtocol”:“无法将值“3312”转换为类型 “System.Net.SecurityProtocolType”由于无效的枚举值。 指定以下枚举值之一,然后重试。这 可能的枚举值为“Ssl3,Tls”。”在 line:1 char:85 + Set-ExecutionPolicy Bypass -Scope Process -Force; [System.Net.ServicePointManager]:: https://ch ocolatey.org/install.ps1')) + CategoryInfo : InvalidOperation: (:) [], RuntimeException + FullyQualifiedErrorId : PropertyAssignmentException
使用“1”个参数调用“DownloadString”的异常:“The 底层连接已关闭:出现意外错误 发送。”在 line:1 char:219 + Set-ExecutionPolicy Bypass -Scope Process -Force; [System.Net.ServicePointManager]::SecurityProtocol = [System.Net.Se rvicePointManager]::SecurityProtocol -bor 3072; iex ((新对象 System.Net.WebClient).DownloadString https://ch ocolatey.org/install.ps1')) + CategoryInfo : NotSpecified: (:) [], MethodInvocationException + FullyQualifiedErrorId : DotNetMethodException
【问题讨论】:
-
您是在 PowerShell 中执行这些命令吗?是 PowerShell v2($PSVersionTable 会告诉你)吗?
-
我正在使用命令提示符执行它们。我再次尝试使用 PowerShell,并用它给出的不同错误更新了我的答案。 (是的,我的 PSVersion 是 2.0 。)
-
他们为什么选择让安装变得如此难以置信复杂?自 90 年代以来我一直在使用 Microsoft Windows,我从未见过如此复杂的安装过程。为什么不简单地让用户下载一个简单的 EXE 文件,或者一个带有 EXE 和 helpers 的 ZIP 文件,或者一个简单的“Next,Next,Next,Finish”设置 EXE?
-
那么...你解决了这个问题吗兄弟?解决方案是什么?
标签: shell command-line chocolatey