Chocolatey is the Windows version of Linux’s apt or dnf.

Open Administrator Powershell.

Set up $profile in PowerShell

See the contents of $profile:

Write-Host $profile

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

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(''))

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-Expression to execute a command
  • New-Object System.Net.WebClient: Creates a WebClient object
  • DownloadString: A WebClient method to download a script from a string
  • Script to install Chocolatey. You can open this link to review the code.

Reload profile: