# Chocolatey



### [Installation](https://chocolatey.org/install)

Chocolatey nécessite PowerShell avec droits Administrateur.

Lancer:
```powershell
PS Get-ExecutionPolicy
RemoteSigned
```
Si la réponse est `Restricted`, lancez:
```powershell
PS Set-ExecutionPolicy AllSigned or Set-ExecutionPolicy Bypass -Scope Process
```

Puis lancez la commande suivante:
```powershell
PS Set-ExecutionPolicy Bypass -Scope Process -Force; [System.Net.ServicePointManager]::SecurityProtocol = [System.Net.ServicePointManager]::SecurityProtocol -bor 3072; iex ((New-Object System.Net.WebClient).DownloadString('https://chocolatey.org/install.ps1'))
```

Si il n'y a pas d'erreur, lancer Choco
```powershell
PS choco
Chocolatey v0.10.15
Please run 'choco -?' or 'choco <command> -?' for help menu.
```



### [Commandes](https://chocolatey.org/docs/commands-reference)



### [Packages](https://chocolatey.org/packages)

#### [:octicons-link:](https://chocolatey.org/docs/commands-install) Installer un paquet `choco install` (`cinst`):

```powershell
PS choco install chocolateygui
Chocolatey v0.10.15
Installing the following packages:
chocolateygui
By installing you accept licenses for the packages.
Progress: Downloading ChocolateyGUI 0.17.0... 100%
Progress: Downloading DotNet4.5.2 4.5.2.20140902... 100%

DotNet4.5.2 v4.5.2.20140902 [Approved]
dotnet4.5.2 package files install completed. Performing other installation steps.
The package DotNet4.5.2 wants to run 'ChocolateyInstall.ps1'.
Note: If you don't run this script, the installation will fail.
Note: To confirm automatically next time, use '-y' or consider:
choco feature enable -n allowGlobalConfirmation
Do you want to run the script?([Y]es/[A]ll - yes to all/[N]o/[P]rint): Y

# Forcer la réinstallation: -f --force
```

#### [:octicons-link:](https://chocolatey.org/docs/commands-uninstall) Désinstaller un paquet `choco uninstall` (`cuninst`):

```powershell
PS choco uninstall vcxsrv
Chocolatey v0.10.15
Uninstalling the following packages:
vcxsrv

vcxsrv v1.20.8.1
The package vcxsrv wants to run 'chocolateyuninstall.ps1'.
Note: If you don't run this script, the installation will fail.
Note: To confirm automatically next time, use '-y' or consider:
choco feature enable -n allowGlobalConfirmation
Do you want to run the script?([Y]es/[A]ll - yes to all/[N]o/[P]rint): A
```

#### [:octicons-link:](https://chocolatey.org/docs/commands-list) Liste des paquets installés `choco list` (`clist`):

```powershell
# Applications installées par Chocolatey

PS choco list --local-only
Chocolatey v0.10.15
chocolatey 0.10.15
chocolatey-core.extension 1.3.5.1
chocolateygui 0.17.0
DotNet4.5.2 4.5.2.20140902
git.install 2.26.2
vscode 1.44.2
vscode.install 1.44.2

# Applications installées par Chocolatey et toutes les autres.
PS choco list -lai
```

#### [:octicons-link:](https://chocolatey.org/docs/commands-search) Rechercher un paquet `choco search` (`clist`):

```powershell
# Chercher les paquets relatifs à Git

PS choco search git
# PS clist git
Chocolatey v0.10.15
git 2.26.2 [Approved]
git-helper 1.5 - Possibly broken
Git-TF 2.0.3.20131219 [Approved]
git-it 4.4.0 [Approved]
EthanBrown.GitAliases 0.0.5
git-lfx 0.1.0 [Approved]
git-interactive-rebase-tool 1.1.0 [Approved] Downloads cached for licensed users
git.portable 2.26.2 [Approved]

# Plus d'infos

PS choco search git --detailed
.../...
vscodium.install 1.44.2 [Approved]
 Title: VSCodium (Install) | Published: 21/04/2020
 Package approved by Pauby on avr. 21 2020 12:26:11.
 Package testing status: Passing on avr. 21 2020 10:27:25.
 Number of Downloads: 5624 | Downloads for this version: 1259
 Package url
 Chocolatey Package Source: https://github.com/Thilas/chocolatey-packages/tree/master/vscodium.install
 Package Checksum: 'tsygmUY9Krl1xcp+Z/rk1tShITJQ4X5KTM+lh/cR+WtxOELWfZO8MY/ndDzgJmUZuhDiFQVCGLb5s9P0/5bLng==' (SHA512)
 Tags: vscodium admin foss cross-platform microsoft visualstudiocode vscode development editor ide javascript typescript
 Software Site: https://github.com/VSCodium/vscodium
 Software License: https://github.com/VSCodium/vscodium/blob/master/LICENSE
 Software Source: https://github.com/VSCodium/vscodium
 Documentation: https://code.visualstudio.com/docs
 Issues: https://github.com/VSCodium/vscodium/issues
 Summary: VSCodium (Install)
 Description: Free/Libre Open Source Software binaries of [Visual Studio Code](https://chocolatey.org/packages/vscode).

  Visual Studio Code is a lightweight but powerful source code editor which runs on your desktop and is available for Windows, macOS and Linux. It comes with built-in support for JavaScript, TypeScript and Node.js and has a rich ecosystem of extensions for other languages (such as C++, C#, Java, Python, PHP, Go) and runtimes (such as .NET and Unity).
.../...

# Chercher exactement 'Git'

PS choco search git --exact
Chocolatey v0.10.15
git 2.26.2 [Approved]
1 packages found.
```

#### [:octicons-link:](https://chocolatey.org/docs/commands-info) Info sur un paquet `choco info`:

```powershell
PS choco info git
Chocolatey v0.10.15
git 2.26.2 [Approved]
 Title: Git | Published: 20/04/2020
 Package approved by AdmiringWorm on avr. 21 2020 12:07:36.
 Package testing status: Passing on avr. 20 2020 18:46:36.
 Number of Downloads: 3756434 | Downloads for this version: 52727
 Package url
 Chocolatey Package Source: https://github.com/chocolatey-community/chocolatey-coreteampackages/tree/master/automatic/git
 
# Synonyme à choco search <pkgname> --exact --detailed
```

#### [:octicons-link:](https://chocolatey.org/docs/commands-outdated) Paquets non à jour `choco outdated`:

```powershell
PS choco outdated
Chocolatey v0.10.15
Outdated Packages
 Output is package name | current version | available version | pinned?


Chocolatey has determined 0 package(s) are outdated.
```

#### [:octicons-link:](https://chocolatey.org/docs/commands-upgrade) Mettre à jour un/des paquets `choco upgrade` (`cup`):

```powershell
# Mettre à jour un ou plusieurs paquets
PS choco upgrade <pkg1 pkg2>

# Mettre à jour tous les paquets
PS choco upgrade all
```

#### [:octicons-link:](https://chocolatey.org/docs/commands-pin) Empêcher de mettre à jour un paquet `choco pin`:

```powershell
# Bloquer les maj de chocolateygui

PS choco pin add -n=chocolateygui
Chocolatey v0.10.15
Trying to add a pin for chocolateygui
Successfully added a pin for chocolateygui v0.17.0.

# Liste des paquets 'pinned'

PS choco pin list
Chocolatey v0.10.15
chocolateygui|0.17.0

# Débloquer les maj de chocolateygui

PS choco pin remove --name chocolateygui
Chocolatey v0.10.15
Trying to remove a pin for chocolateygui
Successfully removed a pin for chocolateygui v0.17.0.
```

#### [:octicons-link:](https://chocolatey.org/docs/commands-config) Configuration de chocolatey `choco config`:

```powershell
PS choco config list
Chocolatey v0.10.15
Settings
cacheLocation =  | Cache location if not TEMP folder. Replaces `$env:TEMP` value for choco.exe process. It is highly recommended this be set to make Chocolatey more deterministic in cleanup.
.../...

Sources
chocolatey - https://chocolatey.org/api/v2/ | Priority 0|Bypass Proxy - False|Self-Service - False|Admin Only - False.

NOTE: Use choco source to interact with sources.

Features
[x] checksumFiles - Checksum files when pulled in from internet (based on package).
[x] autoUninstaller - Uninstall from programs and features without requiring an explicit uninstall script.
.../...
```

