【笔记】Winget学习笔记

前言

用户可以在 Windows 10 和 Windows 11 计算机上使用 winget 命令行工具来发现、安装、升级、删除和配置应用程序。 此工具是 Windows 程序包管理器服务的客户端接口。(Microsoft Docs

Winget安装的软件包所在的文件夹

  • %LocalAppData%\Microsoft\WinGet\Packages

安装Winget

  • microsoft/winget-cli下载.msixbundle文件

  • 双击打开程序(打开方式为MicrosoftStore)

同意协议

  • 部分软件需要从微软商店下载,首次使用需要同意微软商店使用协议
1
2
3
4
5
6
The `msstore` source requires that you view the following agreements before using.
Terms of Transaction: https://aka.ms/microsoft-store-terms-of-transaction
The source requires the current machine's 2-letter geographic region to be sent to the backend service to function properly (ex. "US").

Do you agree to all the source agreements terms?
[Y] Yes [N] No: Y

查找软件

查找全部软件

1
winget search

查找指定关键字的软件

<keywords>:关键字

1
winget search <keywords>

显示安装包相关信息

1
winget show <app>

安装软件

<app>:软件包名
-l <dir>:指定安装文件夹

1
winget install <app>

彩虹进度条

1
winget install --rainbow <app>

跳过哈希校验

  • 如果报错:安装程序哈希不匹配,跳过哈希校验

以非管理员身份跳过哈希校验

1
winget install <app> --ignore-security-hash
  • 如果报错:安装程序哈希不匹配;以管理员身份运行时不能覆盖此内容

以管理员身份允许哈希重写

1
winget settings --enable InstallerHashOverride

以非管理员身份跳过哈希校验

1
winget install --ignore-security-hash <app>

强制安装

1
winget install --force <app>

卸载软件

  • 启动软件的卸载程序
1
winget uninstall <app>

升级软件

升级所有软件

1
winget upgrade

升级指定软件

1
winget upgrade <app>

显示所有已安装的软件包

1
winget list

显式版本号

1
winget -v
1
winget --version

查看帮助

1
winget

查看安装时的参数

1
winget show --help

完成

参考文献

CSDN——一只野猪佩奇
西瓜视频——爱比较
CSDN——hufang360