Chocolatey is the Windows version of Linux’s
Open Administrator Powershell.
Set up $profile in PowerShell
See the contents of
This only shows the variable’s content but the file doesn’t exist there:
Create the file as seen in the Microsoft docs here:
New-Item -Path $profile -ItemType "file" -Force
Install Chocolatey as seen in the official docs here.
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'))
Even though, the docs don’t fully explain exactly what this does. Here is a short summary form ChatGPT:
...this command sets up the PowerShell environment to allow the execution of scripts without any restrictions, updates the security protocol used for connecting to remote servers, and then downloads and installs the Chocolatey package manager using a script from a specific URL.
More detail about every command:
Set-ExecutionPolicy Bypass: Sets PowerShell execution policy to Bypass for the current process
-Scope Process: Only apply to the current PowerShell session
-Force: Supress any confirmation prompt
-bor: Bitwise OR operator
3072: Represents the TSL 1.2 security protocol
[System.Net.ServicePointManager]::SecurityProtocol -bor 3072: Bitwise OR between the current security protocol and TSL 1.2 to allow connection to remote servers
iex: Same as PowerShell
Invoke-Expressionto execute a command
New-Object System.Net.WebClient: Creates a
WebClientmethod to download a script from a string
https://community.chocolatey.org/install.ps1: Script to install Chocolatey. You can open this link to review the code.