如何使用文件 chocolatey.0.10.15.nupkg 安装 Chocolatey?

How can I install Chocolatey with the file chocolatey.0.10.15.nupkg?

我在使用 Chocolatey link 的 PowerShell 控制台中遇到错误。

chocolatey's link error

如果没有解决方案,我需要学习如何使用下载的文件“chocolatey.0.10.15.nupkg”安装Chocolatey。

chocolatey's file .nupkg

安装 choco 是一个非常常见的用例,包括 NuGet。

PowerShell 已经附带了一个包管理器,该管理器使用它已经默认安装的 NuGet。您仍然可以出于其他原因安装 choco,但对于每天正常使用 PowerShell 而言,不需要它。

Installing PowerShellGet https://docs.microsoft.com/en-us/powershell/scripting/gallery/installing-psget?view=powershell-7

PowerShellGet 是以下版本中的一个 in-box 模块 Windows 10 或更高版本 Windows Server 2016 或更高版本 Windows 管理框架 (WMF) 5.0 或更高版本的 PowerShell 6

在 PowerShell 会话中设置安全级别。

# Required for use with web SSL sites
[Net.ServicePointManager]::SecurityProtocol = [Net.ServicePointManager]::SecurityProtocol -bor [Net.SecurityProtocolType]::Tls12

如果您的 ExecutionPolicy 设置为 AllSigned,则您 运行 必须签署任何脚本。否则,在您的用户会话中将 ExecutionPolicy 设置为 RemoteSigned 或 ByPass。

How to Install Chocolatey using PowerShell

Set-ExecutionPolicy Bypass -Scope Process -Force; Invoke-Expression (
    (New-Object System.Net.WebClient).DownloadString('https://chocolatey.org/install.ps1')
)