Skip to main content
The import command installs packages listed in a JSON file created by the export command.

Syntax

winget import <import-file> [options]

Required Arguments

import-file
path
required
Path to JSON file containing package list

Options

-i, --import-file
path
Import file path (alternative to positional argument)
--ignore-unavailable
flag
Continue if some packages are not found
--ignore-versions
flag
Install latest versions instead of specified versions
--no-upgrade
flag
Skip packages that are already installed
--accept-package-agreements
flag
Accept all license agreements
--accept-source-agreements
flag
Accept all source agreements

Examples

Import packages:
winget import packages.json
Import with automatic agreements:
winget import packages.json --accept-package-agreements --accept-source-agreements
Import latest versions:
winget import packages.json --ignore-versions
Import ignoring unavailable packages:
winget import packages.json --ignore-unavailable
Import without upgrading existing:
winget import packages.json --no-upgrade

Import Process

The import command:
  1. Reads JSON file
  2. Validates package identifiers
  3. Checks which packages are already installed
  4. Installs or upgrades packages as needed
  5. Reports results for each package

Output

Importing packages from: packages.json
Found 5 packages to install

[1/5] Installing Microsoft.PowerToys 0.71.0...
✓ Successfully installed

[2/5] Installing Microsoft.VisualStudioCode 1.80.0...
✓ Already installed

[3/5] Installing Python.Python.3.11...
✓ Successfully installed

[4/5] Installing Git.Git...
✗ Package not found in source

[5/5] Installing Docker.DockerDesktop...
✓ Successfully installed

Import completed.
Successful: 3
Already installed: 1
Failed: 1

Import File Format

Expects JSON format from winget export:
{
  "$schema": "https://aka.ms/winget-packages.schema.2.0.json",
  "Sources": [
    {
      "SourceDetails": {
        "Name": "winget"
      },
      "Packages": [
        {
          "PackageIdentifier": "Microsoft.PowerToys",
          "Version": "0.71.0"
        }
      ]
    }
  ]
}

Behavior Flags

—ignore-unavailable

Continues installation if some packages aren’t found:
winget import packages.json --ignore-unavailable
Without flag, import stops on first unavailable package.

—ignore-versions

Installs latest versions instead of specified versions:
winget import packages.json --ignore-versions

—no-upgrade

Skips packages already installed (no upgrade):
winget import packages.json --no-upgrade

Use Cases

New System Setup

Quickly set up a new machine:
winget import my-tools.json --accept-package-agreements --accept-source-agreements

Restore from Backup

Restore after system reset:
winget import backup.json --ignore-versions

Team Onboarding

Standardized developer setup:
winget import dev-environment.json

Testing

Set up test environment:
winget import test-tools.json --ignore-unavailable

Error Handling

By default, import stops on first error. Use --ignore-unavailable to continue:
# Stops on first error
winget import packages.json

# Continues despite errors
winget import packages.json --ignore-unavailable

Exit Codes

  • 0 - All packages installed successfully
  • 0x8A150025 - Import file not found or invalid
  • 0x8A150028 - Some packages failed to install
  • 0x8A150001 - Package not found (without —ignore-unavailable)
The import command respects package pins. Pinned packages won’t be upgraded unless forced.
Importing installs packages in the order they appear in the JSON file.

Build docs developers (and LLMs) love