« Chocolatey » : différence entre les versions
De Banane Atomic
Aller à la navigationAller à la recherche
(→CLI) |
|||
(2 versions intermédiaires par le même utilisateur non affichées) | |||
Ligne 27 : | Ligne 27 : | ||
== Upgrade == | == Upgrade == | ||
<kode lang='ps'> | <kode lang='ps'> | ||
# list outdated packages | |||
choco outdated | |||
# tous mettre à jour | # tous mettre à jour | ||
choco upgrade all | choco upgrade all | ||
Ligne 38 : | Ligne 41 : | ||
# pin / unpin a package so it will stay in the current version | # pin / unpin a package so it will stay in the current version | ||
choco pin add -n <Package_Name> | choco pin add -n <Package_Name> | ||
choco pin add --name="'<Package_Name>'" --version="'<Package_Version>'" | |||
choco pin remove -n <Package_Name> | choco pin remove -n <Package_Name> | ||
Ligne 48 : | Ligne 52 : | ||
choco install <Package_Name> --version=1.2.3 --allow-downgrade | choco install <Package_Name> --version=1.2.3 --allow-downgrade | ||
# --force | # --force | ||
</kode> | |||
= Clean = | |||
<kode lang='ps'> | |||
# install choco-cleaner | |||
choco install choco-cleaner | |||
# run | |||
choco-cleaner | |||
</kode> | </kode> | ||
Dernière version du 4 juillet 2022 à 09:14
Informations
Chocolatey est un gestionnaire de paquets pour Windows.
- Les paquets sont installés dans C:\ProgramData\chocolatey
- Les installers sont téléchargés dans %Temp%\chocolatey
- log dans C:\ProgramData\chocolatey\logs\chocolatey.log
CLI
Lancer le terminal en mode administrateur pour les opérations d'installation. |
# recherche d'un package choco search <Package_Name> # installation choco install <Package_Name> # --version x.x # désinstallation choco uninstall <Package_Name> # -a all version # -x uninstall dependencies # lister les paquets locaux choco list -l |
Upgrade
# list outdated packages choco outdated # tous mettre à jour choco upgrade all # tous mettre à jour sauf un package choco upgrade all --except=<Package_Name> # mise à jour d'un package choco upgrade <Package_Name> # pin / unpin a package so it will stay in the current version choco pin add -n <Package_Name> choco pin add --name="'<Package_Name>'" --version="'<Package_Version>'" choco pin remove -n <Package_Name> # list the pin packages choco pin list |
Downgrade
choco install <Package_Name> --version=1.2.3 --allow-downgrade # --force |
Clean
# install choco-cleaner choco install choco-cleaner # run choco-cleaner |
Installation
# dans une console administrateur 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')) # mise à jour choco upgrade chocolatey |
%UserProfile%\Documents\WindowsPowerShell\Microsoft.PowerShell_profile.ps1 |
# Chocolatey profile $ChocolateyProfile = "$env:ChocolateyInstall\helpers\chocolateyProfile.psm1" if (Test-Path($ChocolateyProfile)) { Import-Module "$ChocolateyProfile" } |
Function.ps1 |
New-Alias cs choco-search New-Alias ci choco-install New-Alias cu choco-upgrade New-Alias cl choco-list function choco-search { choco search $args } function choco-install { #Start-Process powershell.exe -Verb RunAs 'choco install -y $args' choco install -y $args } function choco-upgrade { #Start-Process powershell.exe -Verb RunAs 'choco upgrade all' choco upgrade all } function choco-list { choco list -l } |