# Chocolatey

## Installing Chocolatey

Install with cmd.exe

```
@"%SystemRoot%\System32\WindowsPowerShell\v1.0\powershell.exe" -NoProfile -InputFormat None -ExecutionPolicy Bypass -Command "iex ((New-Object System.Net.WebClient).DownloadString('https://chocolatey.org/install.ps1'))" && SET "PATH=%PATH%;%ALLUSERSPROFILE%\chocolatey\bin"
```

Install with PowerShell

```
Set-ExecutionPolicy Bypass -Scope Process -Force; iex ((New-Object System.Net.WebClient).DownloadString('https://chocolatey.org/install.ps1'))
```

Source: <https://chocolatey.org/docs/installation>

## Install / Upgrade Packages

Note: Remember to run as administrator

**To install:**

```
choco install [package name]
```

```
cinst [package name]
```

**List outdated packages:**

```bash
choco outdated
```

**Upgrade all outdated packages that aren't pinned:**

```bash
choco upgrade all
```

```bash
cup all
```

**Options:**

* Install/upgrade in a specific directory: `--params="'/installLocation:""C:\tools""'"`

Install source: <https://chocolatey.org/docs/commandsinstall> Upgrade source: <https://chocolatey.org/docs/commandsupgrade>

## Pin

### Usage

```
choco pin [list]|add|remove [<options/switches>]
```

### Examples

```
choco pin
choco pin list
choco pin add -n=git
choco pin add -n=git --version 1.2.3
choco pin remove --name git
```

Source: <https://chocolatey.org/docs/commandspin>

## List

### Usage

```bash
  choco search <filter> [<options/switches>]
```

```bash
  choco list <filter> [<options/switches>]
```

```bash
  clist <filter> [<options/switches>]
```

### Options

* Only local: `-l`, `--lo`, `--localonly`, `--local-only`
* Exact name: `-e`, `--exact`

Source: <https://chocolatey.org/docs/commandslist>


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://cheatsheet.che.wf/cli/chocolatey.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
