- Use the winget tool to install and manage applications
- Install winget
- Administrator considerations
- Use winget
- Commands
- Options
- Supported installer formats
- Scripting winget
- Missing tools
- Customize winget settings
- Open source details
- команда install (интерфейс командной строки NuGet) install command (NuGet CLI)
- Использование Usage
- Варианты Options
- install command (winget)
- Usage
- Arguments
- Options
- Example queries
- Multiple selections
- Local install
- Log files
Use the winget tool to install and manage applications
Windows Package Manager and the winget tool are in public preview and may be substantially modified before they are generally available. Microsoft makes no warranties, express or implied, with respect to the information provided here.
The winget command line tool enables developers to discover, install, upgrade, remove and configure applications on Windows 10 computers. This tool is the client interface to the Windows Package Manager service.
The winget tool is currently a preview, so not all planned functionality is available at this time.
Install winget
There are several ways to install the winget tool:
The winget tool is included in the flight or preview version of Windows App Installer. You must install the preview version of App Installer to use winget. To gain early access, submit your request to the Windows Package Manager Insiders Program. Participating in the flight ring will guarantee you see the latest preview updates.
Install the Windows Desktop App Installer package located on the Releases page for the winget repository.
The winget tool requires Windows 10, version 1709 (10.0.16299), or a later version of Windows 10.
Administrator considerations
Installer behavior can be different depending on whether you are running winget with administrator privileges.
When running winget without administrator privileges, some applications may require elevation to install. When the installer runs, Windows will prompt you to elevate. If you choose not to elevate, the application will fail to install.
When running winget in an Administrator Command Prompt, you will not see elevation prompts if the application requires it. Always use caution when running your command prompt as an administrator, and only install applications you trust.
Use winget
After App Installer is installed, you can run winget by typing ‘winget’ from a Command Prompt.
One of the most common usage scenarios is to search for and install a favorite tool.
To search for a tool, type winget search .
After you have confirmed that the tool you want is available, you can install the tool by typing winget install . The winget tool will launch the installer and install the application on your PC.
In addition to install and search, winget provides a number of other commands that enable you to show details on applications, change sources, and validate packages. To get a complete list of commands, type: winget —help .
Commands
The current preview of the winget tool supports the following commands.
Command | Description |
---|---|
hash | Generates the SHA256 hash for the installer. |
help | Displays help for the winget tool commands. |
install | Installs the specified application. |
search | Searches for an application. |
show | Displays details for the specified application. |
source | Adds, removes, and updates the Windows Package Manager repositories accessed by the winget tool. |
validate | Validates a manifest file for submission to the Windows Package Manager repository. |
Options
The current preview of the winget tool supports the following options.
Option | Description |
---|---|
-v,—version | Returns the current version of winget. |
—info | Provides you with all detailed information on winget, including the links to the license and privacy statement. |
-?, —help | Shows additional help for winget. |
Supported installer formats
The current preview of the winget tool supports the following types of installers:
Scripting winget
You can author batch scripts and PowerShell scripts to install multiple applications.
When scripted, winget will launch the applications in the specified order. When an installer returns success or failure, winget will launch the next installer. If an installer launches another process, it is possible that it will return to winget prematurely. This will cause winget to install the next installer before the previous installer has completed.
Missing tools
If the community repository does not include your tool or application, please submit a package to our repository. By adding your favorite tool, it will be available to you and everyone else.
Customize winget settings
You can configure the winget command line experience by modifying the settings.json file. For more information, see https://aka.ms/winget-settings. Note that the settings are still in an experimental state and not yet finalized for the preview version of the tool.
Open source details
The winget tool is open source software available on GitHub in the repo https://github.com/microsoft/winget-cli/. The source for building the client is located in the src folder.
The source for winget is contained in a Visual Studio 2019 C++ solution. To build the solution correctly, install the latest Visual Studio with the C++ workload.
We encourage you to contribute to the winget source on GitHub. You must first agree to and sign the Microsoft CLA.
команда install (интерфейс командной строки NuGet) install command (NuGet CLI)
Область применения: • Поддерживаемые версии для использования пакетов: все Applies to: package consumption • Supported versions: all
Скачивает и устанавливает пакет в проект по умолчанию для текущей папки с использованием указанных источников пакетов. Downloads and installs a package into a project, defaulting to the current folder, using specified package sources.
Чтобы загрузить пакет непосредственно за пределами контекста проекта, посетите страницу пакета на сайте NuGet.org и выберите ссылку для скачивания . To download a package directly outside the context of a project, visit the package’s page on nuget.org and select the Download link.
Если источники не указаны, используются указанные в глобальном файле конфигурации %appdata%\NuGet\NuGet.Config (Windows) или
/.nuget/NuGet/NuGet.Config (Mac/Linux). If no sources are specified, those listed in the global configuration file, %appdata%\NuGet\NuGet.Config (Windows) or
/.nuget/NuGet/NuGet.Config (Mac/Linux), are used. Дополнительные сведения см. в разделе Общие конфигурации NuGet . See Common NuGet configurations for additional details.
Если конкретные пакеты не указаны, install устанавливает все пакеты, перечисленные в packages.config файле проекта, делая его похожим на restore . If no specific packages are specified, install installs all packages listed in the project’s packages.config file, making it similar to restore .
install Команда не изменяет файл проекта или packages.config ; в этом случае он похож на тот restore , что он добавляет только пакеты на диск, но не изменяет зависимости проекта. The install command does not modify a project file or packages.config ; in this way it’s similar to restore in that it only adds packages to disk but does not change a project’s dependencies.
Чтобы добавить зависимость, либо добавьте пакет через пользовательский интерфейс или консоль диспетчера пакетов в Visual Studio, либо измените, packages.config а затем запустите либо install restore . To add a dependency, either add a package through the Package Manager UI or Console in Visual Studio, or modify packages.config and then run either install or restore .
Использование Usage
имя устанавливаемого пакета (с использованием последней версии) или файл, в котором packages.config перечислены пакеты для установки. where
names the package to install (using the latest version), or identifies the packages.config file that lists the packages to install. Можно указать конкретную версию с помощью -Version параметра. You can indicate a specific version with the -Version option.
Варианты Options
-ConfigFile
Файл конфигурации NuGet, который необходимо применить. The NuGet configuration file to apply. Если не указано, %AppData%\NuGet\NuGet.Config используется (Windows) или
/.config/NuGet/NuGet.Config (Mac/Linux). If not specified, %AppData%\NuGet\NuGet.Config (Windows), or
/.config/NuGet/NuGet.Config (Mac/Linux) is used.
-DependencyVersion
(4.4 +) Используемая версия пакетов зависимостей, которая может быть одной из следующих: (4.4+) The version of the dependency packages to use, which can be one of the following:
- Самый низкий (по умолчанию): самая низкая версия Lowest (default): the lowest version
- Хигхестпатч: версия с наименьшим основным, наименьшим незначительным, самым высоким исправлением HighestPatch: the version with the lowest major, lowest minor, highest patch
- Хигхестминор: версия с наименьшим основным, наибольшим незначительным, самым высоким исправлением HighestMinor: the version with the lowest major, highest minor, highest patch
- Наибольшее: самая высокая версия Highest: the highest version
- Ignore: пакеты зависимостей не будут использоваться Ignore: No dependency packages will be used
-DirectDownload
Скачайте напрямую, не заполняя никакие кэши метаданными или двоичными файлами. Download directly without populating any caches with metadata or binaries.
-DisableParallelProcessing
Отключает параллельную установку нескольких пакетов. Disables installing multiple packages in parallel.
-x|-ExcludeVersion
Устанавливает пакет в папку с именем только с именем пакета, а не с номером версии. Installs the package to a folder named with only the package name and not the version number.
-FallbackSource
(3.2 +) Список источников пакетов, используемых в качестве резервных при условии, что пакет не найден в основном источнике или по умолчанию. (3.2+) A list of package sources to use as fallbacks in case the package isn’t found in the primary or default source.
-ForceEnglishOutput
(3.5 +) Принудительное выполнение nuget.exe с использованием инвариантного языка и региональных параметров, основанных на английском языке. (3.5+) Forces nuget.exe to run using an invariant, English-based culture.
-Framework
(4.4 +) Целевая платформа, используемая для выбора зависимостей. (4.4+) Target framework used for selecting dependencies. Если не указано, по умолчанию используется значение Any. Defaults to ‘Any’ if not specified.
-?|-help
Отображает справочные сведения для команды. Displays help information for the command.
-NoCache
Предотвращает использование кэшированных пакетов NuGet. Prevents NuGet from using cached packages. См. раздел Управление глобальными пакетами и папками кэша. See Managing the global packages and cache folders.
-NonInteractive
Подавляет запросы на ввод или подтверждение пользователя. Suppresses prompts for user input or confirmations.
-OutputDirectory
Указывает папку, в которой устанавливаются пакеты. Specifies the folder in which packages are installed. Если папка не указана, используется текущая папка. If no folder is specified, the current folder is used.
-PackageSaveMode
Указывает типы файлов, которые необходимо сохранить после установки пакета: один из nuspec , nupkg или nuspec;nupkg . Specifies the types of files to save after package installation: one of nuspec , nupkg , or nuspec;nupkg .
-PreRelease
Разрешает установку пакетов предварительного выпуска. Allows prerelease packages to be installed. Этот флаг не требуется при восстановлении пакетов с помощью packages.config . This flag is not required when restoring packages with packages.config .
-RequireConsent
Проверяет, что восстановление пакетов включено перед загрузкой и установкой пакетов. Verifies that restoring packages is enabled before downloading and installing the packages. Дополнительные сведения см. в разделе восстановление пакетов. For details, see Package Restore.
-SolutionDirectory
Указывает корневую папку решения, для которого восстанавливаются пакеты. Specifies root folder of the solution for which to restore packages.
-Source
Указывает список источников пакетов (в виде URL-адресов) для использования. Specifies the list of package sources (as URLs) to use. Если этот параметр не указан, команда использует источники, предоставленные в файлах конфигурации, см. раздел Общие конфигурации NuGet. If omitted, the command uses the sources provided in configuration files, see Common NuGet configurations.
-Verbosity [normal|quiet|detailed]
Задает объем сведений, отображаемых в выходных данных: normal (по умолчанию), quiet или detailed . Specifies the amount of detail displayed in the output: normal (the default), quiet , or detailed .
-Version
Указывает версию устанавливаемого пакета. Specifies the version of the package to install.
install command (winget)
Windows Package Manager and the winget tool are in public preview and may be substantially modified before they are generally available. Microsoft makes no warranties, express or implied, with respect to the information provided here.
The install command of the winget tool installs the specified application. Use the search command to identify the application you want to install.
The install command requires that you specify the exact string to install. If there is any ambiguity, you will be prompted to further filter the install command to an exact application.
Usage
winget install [[-q] \ ] [\ ]
Arguments
The following arguments are available.
Argument | Description |
---|---|
-q,—query | The query used to search for an app. |
-?, —help | Get additional help on this command. |
Options
The options allow you to customize the install experience to meet your needs.
Option | Description |
---|---|
-m, —manifest | Must be followed by the path to the manifest (YAML) file. You can use the manifest to run the install experience from a local YAML file. |
—id | Limits the install to the ID of the application. |
—name | Limits the search to the name of the application. |
—moniker | Limits the search to the moniker listed for the application. |
-v, —version | Enables you to specify an exact version to install. If not specified, latest will install the highest versioned application. |
-s, —source | Restricts the search to the source name provided. Must be followed by the source name. |
-e, —exact | Uses the exact string in the query, including checking for case-sensitivity. It will not use the default behavior of a substring. |
-i, —interactive | Runs the installer in interactive mode. The default experience shows installer progress. |
-h, —silent | Runs the installer in silent mode. This suppresses all UI. The default experience shows installer progress. |
-o, —log | Directs the logging to a log file. You must provide a path to a file that you have the write rights to. |
—override | A string that will be passed directly to the installer. |
-l, —location | Location to install to (if supported). |
Example queries
The following example installs a specific version of an application.
The following example installs an application from its ID.
The following example installs an application by version and ID.
Multiple selections
If the query provided to winget does not result in a single application, then winget will display the results of the search. This will provide you with the additional data necessary to refine the search for a correct install.
The best way to limit the selection to one file is to use the id of the application combined with the exact query option. For example:
Local install
The manifest option enables you to install an application by passing in a YAML file directly to the client. The manifest option has the following usage.
Usage: winget install —manifest \
Option | Description |
---|---|
-m, —manifest | The path to the manifest of the application to install. |
Log files
The log files for winget unless redirected, will be located in the following folder: %temp%\AICLI\*.log