Читать книгу PowerShell 7 und Windows PowerShell - Tobias Weltner - Страница 34

Listing 1.5: Chocolatey installieren

Оглавление

Alles Weitere übernimmt das Installationsskript und berichtet über alle Schritte, die es ausführt:

Getting latest version of the Chocolatey package for download.

Getting Chocolatey from https://chocolatey.org/api/v2/package/chocolatey/0.10.15.

Downloading 7-Zip commandline tool prior to extraction.

Extracting C:\Users\tobia\AppData\Local\Temp\chocolatey\chocInstall\chocolatey.zip to C:\Users\tobia\AppData\Local\Temp\chocolatey\chocInstall...

Installing chocolatey on this machine

Creating ChocolateyInstall as an environment variable (targeting 'Machine')

Setting ChocolateyInstall to 'C:\ProgramData\chocolatey'

WARNING: It's very likely you will need to close and reopen your shell before you can use choco.

Restricting write permissions to Administrators

We are setting up the Chocolatey package repository.

The packages themselves go to 'C:\ProgramData\chocolatey\lib'

(i.e. C:\ProgramData\chocolatey\lib\yourPackageName).

A shim file for the command line goes to 'C:\ProgramData\chocolatey\bin' and points to an executable

in 'C:\ProgramData\chocolatey\lib\yourPackageName'.

Creating Chocolatey folders if they do not already exist.

WARNING: You can safely ignore errors related to missing log files when

upgrading from a version of Chocolatey less than 0.9.9.

'Batch file could not be found' is also safe to ignore.

'The system cannot find the file specified' - also safe.

Adding Chocolatey to the profile. This will provide tab completion, refreshenv, etc.

WARNING: Chocolatey profile installed. Reload your profile - type . $profile

Chocolatey (choco.exe) is now ready.

You can call choco from anywhere, command line or powershell by typing choco.

Sobald Chocolatey installiert ist, steht der Befehl choco zur Verfügung. Mit ihm kann man nun auch PowerShell über den folgenden Befehl herunterladen und installieren:

PS> choco install powershell-core

PowerShell 7 und Windows PowerShell

Подняться наверх