Skip to main content
The export command creates a JSON file containing a list of installed packages, which can later be imported on another system.

Syntax

winget export <output-file> [options]

Required Arguments

output-file
path
required
Path where JSON export file will be created

Options

--output
path
Output file path (alternative to positional argument)
-s, --source
string
Export only packages from specified source
--include-versions
flag
Include version information in export
--accept-source-agreements
flag
Accept all source agreements without prompting

Examples

Export all packages:
winget export packages.json
Export with versions:
winget export packages.json --include-versions
Export from specific source:
winget export winget-packages.json --source winget
Export accepting agreements:
winget export packages.json --accept-source-agreements

Export File Format

Without Versions

{
  "$schema": "https://aka.ms/winget-packages.schema.2.0.json",
  "WinGetVersion": "1.6.3482",
  "CreationDate": "2024-03-04T10:30:00.000-08:00",
  "Sources": [
    {
      "SourceDetails": {
        "Name": "winget",
        "Type": "Microsoft.PreIndexed.Package",
        "Argument": "https://cdn.winget.microsoft.com/cache"
      },
      "Packages": [
        {
          "PackageIdentifier": "Microsoft.PowerToys"
        },
        {
          "PackageIdentifier": "Microsoft.VisualStudioCode"
        }
      ]
    }
  ]
}

With Versions

{
  "$schema": "https://aka.ms/winget-packages.schema.2.0.json",
  "WinGetVersion": "1.6.3482",
  "CreationDate": "2024-03-04T10:30:00.000-08:00",
  "Sources": [
    {
      "SourceDetails": {
        "Name": "winget",
        "Type": "Microsoft.PreIndexed.Package",
        "Argument": "https://cdn.winget.microsoft.com/cache"
      },
      "Packages": [
        {
          "PackageIdentifier": "Microsoft.PowerToys",
          "Version": "0.71.0"
        },
        {
          "PackageIdentifier": "Microsoft.VisualStudioCode",
          "Version": "1.80.0"
        }
      ]
    }
  ]
}

Use Cases

System Migration

Export from old system:
winget export old-system.json --include-versions
Import on new system:
winget import old-system.json

Backup

Create periodic backups:
winget export "backup-%date%.json" --include-versions

Team Standardization

Export standard toolset:
winget export team-tools.json

Development Environment

Export dev tools:
winget export dev-environment.json --include-versions

Version Behavior

Without —include-versions

Import installs latest available versions:
{
  "PackageIdentifier": "Microsoft.PowerToys"
}

With —include-versions

Import installs specific versions:
{
  "PackageIdentifier": "Microsoft.PowerToys",
  "Version": "0.71.0"
}

Exit Codes

  • 0 - Success
  • 0x8A150026 - Export file write failed
  • 0x8A150027 - No packages to export
Exported files use JSON format compatible with winget import command.
Only packages installed via WinGet or tracked by WinGet sources are exported.

Build docs developers (and LLMs) love