« Chocolatey » : différence entre les versions
De Banane Atomic
Aller à la navigationAller à la recherche
(10 versions intermédiaires par le même utilisateur non affichées) | |||
Ligne 2 : | Ligne 2 : | ||
= Informations = | = Informations = | ||
[https://chocolatey.org/ Chocolatey] est un gestionnaire de paquets pour Windows. | [https://chocolatey.org/ Chocolatey] est un gestionnaire de paquets pour Windows. | ||
* Les paquets sont installés dans {{boxx|C:\ProgramData\chocolatey | * Les paquets sont installés dans {{boxx|C:\ProgramData\chocolatey}} | ||
* Les installers sont | * Les installers sont téléchargés dans {{boxx|%Temp%\chocolatey}} | ||
* log dans {{boxx|C:\ProgramData\chocolatey\logs\chocolatey.log}} | * log dans {{boxx|C:\ProgramData\chocolatey\logs\chocolatey.log}} | ||
Ligne 11 : | Ligne 11 : | ||
# recherche d'un package | # recherche d'un package | ||
choco search <Package_Name> | choco search <Package_Name> | ||
# installation | # installation | ||
choco install <Package_Name> | choco install <Package_Name> | ||
# --version x.x | |||
# désinstallation | # désinstallation | ||
choco uninstall <Package_Name> | choco uninstall <Package_Name> | ||
# -a all version | |||
# -x uninstall dependencies | |||
# lister les paquets locaux | # lister les paquets locaux | ||
Ligne 22 : | 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 33 : | 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> | ||
# list the pin packages | # list the pin packages | ||
choco pin list | choco pin list | ||
</kode> | |||
== Downgrade == | |||
<kode lang='ps'> | |||
choco install <Package_Name> --version=1.2.3 --allow-downgrade | |||
# --force | |||
</kode> | |||
= Clean = | |||
<kode lang='ps'> | |||
# install choco-cleaner | |||
choco install choco-cleaner | |||
# run | |||
choco-cleaner | |||
</kode> | </kode> | ||
Ligne 42 : | Ligne 66 : | ||
<kode lang='ps'> | <kode lang='ps'> | ||
# dans une console administrateur | # dans une console administrateur | ||
Set-ExecutionPolicy Bypass -Scope Process -Force; iex ((New-Object System.Net.WebClient).DownloadString('https://chocolatey.org/install.ps1')) | 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 | # mise à jour | ||
Ligne 53 : | Ligne 77 : | ||
if (Test-Path($ChocolateyProfile)) { | if (Test-Path($ChocolateyProfile)) { | ||
Import-Module "$ChocolateyProfile" | Import-Module "$ChocolateyProfile" | ||
} | |||
</filebox> | |||
<filebox fn='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 | |||
} | } | ||
</filebox> | </filebox> |
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 } |