PS C:\WINDOWS\system32> Set-ExecutionPolicy Bypass -Scope Process -Force; [System.Net.ServicePointManager]::SecurityProtocol = [System.Net.ServicePointManager]::SecurityProtocol -bor 3072; iex ((New-Object System.Net.WebClient).DownloadString('https://community.chocolatey.org/install.ps1')) Forcing web requests to allow TLS v1.2 (Required for requests to Chocolatey.org) Getting latest version of the Chocolatey package for download. Not using proxy. Getting Chocolatey from https://community.chocolatey.org/api/v2/package/chocolatey/2.0.0. Downloading https://community.chocolatey.org/api/v2/package/chocolatey/2.0.0 to C:\Users\27748\AppData\Local\Temp\chocolatey\chocoInstall\chocolatey.zip Not using proxy. Extracting C:\Users\27748\AppData\Local\Temp\chocolatey\chocoInstall\chocolatey.zip to C:\Users\27748\AppData\Local\Temp\chocolatey\chocoInstall Installing Chocolatey on the local machine Creating ChocolateyInstall as an environment variable (targeting 'Machine') Setting ChocolateyInstall to 'C:\ProgramData\chocolatey' WARNING: It's very likely you will need to close and reopen your shell before you can use choco. Restricting write permissions to Administrators We are setting up the Chocolatey package repository. The packages themselves go to 'C:\ProgramData\chocolatey\lib' (i.e. C:\ProgramData\chocolatey\lib\yourPackageName). A shim file for the command line goes to 'C:\ProgramData\chocolatey\bin' and points to an executable in 'C:\ProgramData\chocolatey\lib\yourPackageName'. Creating Chocolatey folders if they do not already exist. chocolatey.nupkg file not installed in lib. Attempting to locate it from bootstrapper. PATH environment variable does not have C:\ProgramData\chocolatey\bin in it. Adding... 警告: Not setting tab completion: Profile file does not exist at 'C:\Users\27748\Documents\WindowsPowerShell\Microsoft.PowerShell_profile.ps1'. Chocolatey (choco.exe) is now ready. You can call choco from anywhere, command line or powershell by typing choco. Run choco /? for a list of functions. You may need to shut down and restart powershell and/or consoles first prior to using choco. Ensuring Chocolatey commands are on the path Ensuring chocolatey.nupkg is in the lib folder PS C:\WINDOWS\system32>
时间: 2023-07-21 09:50:17 浏览: 142
igniteui-docfx:针对所有可用组件和功能的Ignite UI for Angular主题
这段代码是在 Windows PowerShell 中安装 Chocolatey 的过程,Chocolatey 是一个 Windows 包管理器,可以用来方便地安装、更新和卸载各种软件。这段代码的作用是:
1. 设置 PowerShell 的执行策略为 Bypass,即不限制脚本的执行。
2. 设置 .NET Framework 的安全协议为 TLS 1.2,以便能够从 Chocolatey 官网下载安装包。
3. 使用 WebClient 类下载 Chocolatey 安装脚本,保存到临时文件夹。
4. 解压安装脚本,并执行其中的命令来安装 Chocolatey。
5. 将 Chocolatey 的安装路径加入 PATH 环境变量,以便在命令行中可以直接使用 choco 命令。
注意:在运行此脚本之前,建议先了解脚本的内容,确保它是安全的并符合你的需求。
阅读全文