iTranslated by AI

The content below is an AI-generated translation. This is an experimental feature, and may contain errors. View original article
🪆

Windows: winget: List of Frequently Used Commands

に公開

Introduction

I have explored winget in various ways, so I will explain each winget command and option here as a memorandum.

Command List

Install/Uninstall

  • install
    winget install <package>
    Installs the specified package. You can specify the package by name, ID, or moniker.

  • uninstall
    winget uninstall <package>
    Uninstalls the specified package. If the name is correct, you can also uninstall apps that were not installed via winget.

  • upgrade
    winget upgrade
    Displays a list of packages that can be upgraded.

    PS> winget upgrade
     名前           ID             バージョン  利用可能    ソース
    ------------------------------------------------------------
    Microsoft Edge Microsoft.Edge 91.0.864.59 91.0.864.64 winget
    
    
  • upgrade <package>
    winget upgrade <package>
    Upgrades the specified package.

  • upgrade --all
    winget upgrade --all
    Upgrades all packages that can be upgraded.

  • search
    winget search <query>
    Displays a list of packages that match the specified query. For details on how to write queries, refer to How to specify packages in winget.

  • list
    winget list <query>
    Displays a list of apps installed on Windows. This list includes apps installed via winget.
    Apps displayed in the list can be uninstalled using winget.

    /workspaces > winget list
    名前                                     ID                                        バージョン        利用可能    ソース
    -----------------------------------------------------------------------------------------------------------------------
    sMedio TV Suite                          0E3921EB.sMedioTVSuite_agwrg61xdd7p4      1.1.0.29
    Bitwarden                                Bitwarden.Bitwarden                       1.27.0
    Tweeten                                  MehediHassan.Tweeten                      5.3.0
    Doki Doki Mod Manager 4.3.0              383f299c-84d5-5662-9125-2abaa1144a56      4.3.0
    7-Zip 21.00 alpha (x64)                  7-Zip                                     21.00 alpha
     .
     .
     .
    
    
  • show
    winget show <package>
    Outputs information for the specified package.

    PS> winget show python
    見つかりました Python 3 [Python.Python.3]
    
    Version: 3.9.6150.0
    Publisher: Python Software Foundation
    Author: Python Software Foundation
    Moniker: python3
    Description: Python is a programming language that lets you work more quickly and integrate your systems more effectively.
    Homepage: https://www.python.org
    License: PSF LICENSE AGREEMENT FOR PYTHON
    License Url: https://docs.python.org/3/license.html
    Installer:
      Type: Exe
      Locale: en-US
      Download Url: https://www.python.org/ftp/python/3.9.6/python-3.9.6-amd64.exe
      SHA256: 3924caa094f70fd3ea667a27ad494d57941a487aa72d8b6b79ce60e81f1e497c
    
    

Import / Export

  • import
    winget import <applistfile>
    Installs the packages specified in the file to Windows all at once. Detailed specifications such as installation location cannot be selected.

    PS> winget import .\winget-apps.json
    No applicable update found.
    Package is already installed: Google.Chrome
    Found  [vim.vim]
    This application is licensed to you by its owner.
    Microsoft is not responsible for, nor does it grant any licenses to, third-party packages.
    Downloading https://github.com/vim/vim-win32-installer/releases/download/v8.2.3113/gvim_8.2.3113_x64_signed.exe
      ██████████████████████████████  9.22 MB / 9.22 MB
    Successfully verified installer hash
    Starting package install...
    Successfully installed
    Found  [stack.stack]
    This application is licensed to you by its owner.
    Microsoft is not responsible for, nor does it grant any licenses to, third-party packages.
    Downloading https://binaries.getstack.app/builds/prod/win/x64/Stack%20Setup%203.30.4-x64.exe
      ██████████████████████████████  57.3 MB / 57.3 MB
    Successfully verified installer hash
    Starting package install...
    Successfully installed
    
    
  • export
    winget export <applist>
    Exports a list of installed apps to the specified file in JSON format. For apps and packages that cannot be installed via winget, alert messages will be output.

    PS> winget export out.json
    The installed package version is not available from any source: sMedio TV Suite
    The installed package version is not available from any source: Doki Doki Mod Manager 4.3.0
    The installed package version is not available from any source: 7-Zip 21.00 alpha (x64)
    The installed package version is not available from any source: Adobe Photoshop Express : Image Editor, Adjustments, Filters, Effects, Borders
     .
     .
     .
    
    
  • applist file format
    The exported file will be a JSON file in the following format. Importing this file allows you to install the specified packages all at once.

    {
    "$schema" : "https://aka.ms/winget-packages.schema.2.0.json",
    "CreationDate" : "2021-07-07T02:53:18.991-00:00",
    "Sources" : 
      [
        {
          "Packages" : 
          [
            {
              "PackageIdentifier" : "Bitwarden.Bitwarden"
            },
            {
              "PackageIdentifier" : "vim.vim"
            },
            {
              "PackageIdentifier" : "stack.stack"
            },
            {
              "PackageIdentifier" : "Google.Chrome"
            },
             .
             .
             .
            {
              "PackageIdentifier" : "Microsoft.PowerShell"
            }
          ],
          "SourceDetails" : 
          {
            "Argument" : "https://winget.azureedge.net/cache",
            "Identifier" : "Microsoft.Winget.Source_8wekyb3d8bbwe",
            "Name" : "winget",
            "Type" : "Microsoft.PreIndexed.Package"
          }
        }
      ],
      "WinGetVersion" : "1.0.11694"
    }
    
GitHubで編集を提案

Discussion