ban*_*ing 5 shell command-line chocolatey
我正在遵循Chocolately 安装步骤(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'))
,我收到此错误:
未捕获的语法错误:意外的标识符
..https:
我的命令部分突出显示。
此外,当我尝试执行时Get-ExecutionPolicy
,它会导致:
未捕获的 ReferenceError:未定义获取
任何想法可能是错误的?
* 更新 *
当我在PowerShell 中尝试相同的命令时,出现此错误:
PS C:\Users\mylogin> Set-ExecutionPolicy Bypass -Scope Process -Force; [System.Net.ServicePointManager]::SecurityProtoc ol = [System.Net.ServicePointManager]::SecurityProtocol -bor 3072; iex ((New-Object 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]:: <<<< SecurityProtocol = [System. Net.ServicePointManager]::SecurityProtocol -bor 3072;https://ch oclatey.org/install.ps1')) + CategoryInfo : InvalidOperation: (:) [], RuntimeException +fullyQualifiedErrorId : PropertyAssignmentException
使用“1”参数调用“DownloadString”时出现异常:“底层连接已关闭:发送时发生意外错误。” 在 line:1 char:219 + Set-ExecutionPolicy Bypass -Scope Process -Force; [System.Net.ServicePointManager]::SecurityProtocol = [System.Net.ServicePointManager]::SecurityProtocol -bor 3072; iex ((New-Object System.Net.WebClient).DownloadString <<<< (' https://ch ocolatey.org/install.ps1')) + CategoryInfo : NotSpecified: (:) [], MethodInvocationException +fullyQualifiedErrorId :点网络方法异常
小智 7
Chocolatey.org需要 TLS 1.2才能连接。此错误表明您不支持已安装的:
System.Net.WebClient).DownloadString ('https://chocolatey.org/install.ps1')) Exception setting "SecurityProtocol": "Cannot convert value "3312" to type "System.Net.SecurityProtocolType" due to inv alid enumeration values. Specify one of the following enumeration values and try again. The possible enumeration values are "Ssl3, Tls"
Run Code Online (Sandbox Code Playgroud)
我之前链接的博客文章中的部分应该会有所帮助:
如果您发现自己配置了 Windows 7、Windows Server 2008 或更早版本的计算机,您会发现在我们实施此更改后,这些计算机将无法与 Chocolatey 社区存储库通信。对于这些情况,您将需要使用Chocolatey 的替代安装方法。我们强烈建议使用离线 Chocolatey 安装,因为它提供了最大的灵活性和可靠性。
在Chocolatey 安装页面上列出了要求:
我的建议是完全修补您的 Windows 7 系统,安装 .NET 4.5,然后尝试它。请记住,自今年 1 月以来,Windows 7 已停止支持。
从下载巧克力最新版本
https://chocolatey.org/api/v2/package/chocolatey/
并解压下载的 Chocolatey.0.10.15.nupkg 文件。
在powershell中进入chocolatey.0.10.15/tools文件夹并运行以下命令
调用并.\chocolateyInstall.ps1
允许 Chocolatey 安装