Muokkaa

Jaa


export command (winget)

The export command of the winget tool exports a JSON file of apps to a specified file. The export command uses JSON as the format. You can find the schema for the JSON file used by winget in the Windows Package Manager Client repo on GitHub.

The export combined with the import command allows you to batch install applications on your PC.

The export command is often used to create a file that you can share with other developers, or for use when restoring your build environment.

Usage

winget export [-o] <output> [<options>]

Image of the export command usage

Arguments

The following arguments are available.

Argument Description
-o,--output Path to the JSON file to be created.

Options

The options allow you to customize the export experience to meet your needs.

Option Description
-s, --source [Optional] Specifies a source to export files from. Use this option when you only want files from a specific source.
--include-versions [Optional] Includes the version of the app currently installed. Use this option if you want a specific version. By default, unless specified, import will use latest.
--accept-source-agreements Used to accept the source license agreement, and avoid the prompt.
-?,--help Shows help about the selected command.
--wait Prompts the user to press any key before exiting.
--logs,--open-logs Open the default logs location.
--verbose, --verbose-logs Used to override the logging setting and create a verbose log.
--nowarn,--ignore-warnings Suppresses warning outputs.
--disable-interactivity Disable interactive prompts.
--proxy Set a proxy to use for this execution.
--no-proxy Disable the use of proxy for this execution.

JSON schema

The driving force behind the export command is the JSON file. You can find the schema for the JSON file in the Windows Package Manager Client repo on GitHub.

The JSON file includes the following hierarchy.

Entry Description
Sources The sources application manifests come from.
Packages The collection of packages to install.
PackageIdentifier The Windows Package Manager package identifier used to specify the package.
Version [Optional] The specific version of the package to install.

Exporting files

When the Windows Package Manager exports the JSON file, it attempts to export all the applications installed on the PC. If the winget export command is not able to match an application to an application from an available source, the export command will show a warning.

Note

Matching an application depends on metadata in the manifest from a configured source, and metadata in Add / Remove Programs in Windows based on the package installer.

Image of export command warnings

After the export is complete, you can edit the resulting JSON file in your favorite editor. You can remove apps you do not wish to import in the future.