Chocolatey list without version?

1.2k Views Asked by At

What is the secret flag to use for listing all Chocolatey install packages WITHOUT version (only package names) ? :)

choco list -l

Chocolatey v0.10.15 7zip 19.0 androidstudio 3.5.3.0

choco list -l 'secret flag ?'

Chocolatey 7zip androidstudio

3

There are 3 best solutions below

0
On BEST ANSWER

There isn't a secret flag to enable this.

Part of the value of a package manager is to know what package is installed, and also what version of the package is installed.

You could run the command:

choco list -l -r

Which would output the information in a slightly different format, including a | to separate the package name and version, which you could then parse separately and get only the package names.

0
On

There is no secret flag - but just because there is an official one (at least since v0.10.6 https://github.com/chocolatey/choco/pull/1254 - see choco list -?):

 --idonly, --id-only
 Id Only - Only return Package Ids in the list results. Available in 0.1-
   0.6+.

I suppose you want that list to install the packages again somewhere else. So I also recommend adding -r to "get rid" of the additional output (header/footer):

-r, --limitoutput, --limit-output
 LimitOutput - Limit the output to essential information

The complete command will be choco list -l -r --id-only

0
On

If you use:

choco list -l -r --id-only | ForEach-Object {echo "choco install -y $PSItem"}

will give you a list like:

choco install -y 7zip
choco install -y 7zip.install
choco install -y adobereader
...