Chocolatey is a free package manager for Windows that can be used to download and install software.
Before you can use Chocolatey from PowerShell, you need to download and install it. If you don’t have administrator privileges, use the script below. It downloads the installation script, checks its digital signature to ensure the file is legit, then runs it:
# download and save installation script, then check signature $url = 'https://chocolatey.org/install.ps1' $outPath = "$env:temp\installChocolatey.ps1" Invoke-WebRequest -UseBasicParsing -Uri $url -OutFile $outPath # test signature $result = Get-AuthenticodeSignature -FilePath $outPath if ($result.Status -ne 'Valid') { Write-Warning "Installation Script Damaged/Malware?" exit 1 } # install chocolatey for current user $env:ChocolateyInstall='C:\ProgramData\chocoportable' Start-Process -FilePath powershell -ArgumentList "-noprofile -noExit -ExecutionPolicy Bypass -File ""$outPath""" -Wait # clean up Remove-Item -Path $outPath
To view more installation options, please visit https://chocolatey.org/install.
The above script installs Chocolatey with no administrator privileges as a portable app. To use it, you need to temporarily add the installation folder to the Windows “Path” environment variable. Then run “choco” to test the installation. It reports back its version:
PS> $env:path += ";C:\ProgramData\chocoportable" PS> choco Chocolatey v0.10.8 Please run 'choco -?' or 'choco -?' for help menu. PS>
We’ll take a look at how you can use Chocolatey to automatically download and install PowerShell Core 6, and use it side-by-side with your current Windows PowerShell installation.
Meanwhile, visit https://chocolatey.org/packages?q=notepadplusplus to see what you can install via Chocolatey. Here are the key steps to consider when using Chocolatey:
- Use a PowerShell console window. Do not use PowerShell hosts without a true console window (i.e. ISE)
- Use an elevated PowerShell if possible. Many packages require full Administrator permissions to install software
- Add the Chocolatey installation path to the "Path" environment variable
Once your environment is set up, check out how easy it is now to download and install utilities like Notepad++, for example:
PS C:\> $env:path += ";C:\ProgramData\chocoportable" PS C:\> choco install notepadplusplus -y Chocolatey v0.10.8 [Pending] Removing incomplete install for 'notepadplusplus' Installing the following packages: notepadplusplus By installing you accept licenses for the packages. notepadplusplus.install v7.5.6 [Approved] notepadplusplus.install package files install completed. Performing ot her installation steps. Installing 64-bit notepadplusplus.install... notepadplusplus.install has been installed. notepadplusplus.install installed to 'C:\Program Files\Notepad++' Added C:\ProgramData\chocoportable\bin\notepad++.exe shim pointed to ' c:\program files\notepad++\notepad++.exe'. notepadplusplus.install may be able to be automatically uninstalled. The install of notepadplusplus.install was successful. Software installed as 'exe', install location is likely default. notepadplusplus v7.5.6 [Approved] notepadplusplus package files install completed. Performing other inst allation steps. The install of notepadplusplus was successful. Software install location not explicitly set, could be in package or default install location if installer. Chocolatey installed 2/2 packages. See the log for details (C:\ProgramData\chocoportable\logs\chocolatey .log). PS C:\>
Once Chocolatey finished installing Notepad++, simply press Win+R, and in the “Run” dialog, enter
Notepad++
The editor launches.