WinGet:Windows下官方的包管理器

Windows下官方的包管理器,有国内源

WinGet

winget search xxx  #找出id
winget install <id>

# 更换为国内源,需要管理员权限;重置恢复为官方源 winget source reset winget
winget source remove winget
winget source add winget https://mirrors.ustc.edu.cn/winget-source --trust-level trusted

winget install 7zip.7zip
winget install Microsoft.Edit
winget install Rizonesoft.Notepad3

很像linux apt/yum的命令帮助:

WinGet 命令行实用工具可从命令行安装应用程序和其他程序包。

使用情况: winget  [<命令>] [<选项>]

下列命令有效:
  install    安装给定的程序包
  show       显示包的相关信息
  source     管理程序包的来源
  search     查找并显示程序包的基本信息
  list       显示已安装的程序包
  upgrade    显示并执行可用升级
  uninstall  卸载给定的程序包
  hash       哈希安装程序的帮助程序
  validate   验证清单文件
  settings   打开设置或设置管理员设置
  features   显示实验性功能的状态
  export     导出已安装程序包的列表
  import     安装文件中的所有程序包
  pin        管理包钉
  configure  将系统配置为所需状态
  download   从给定的程序包下载安装程序
  repair     修复所选包
  dscv3      DSC v3 资源命令

如需特定命令的更多详细信息,请向其传递帮助参数。 [-?]

下列选项可用:
  -v,--version                显示工具的版本
  --info                      显示工具的常规信息
  -?,--help                   显示选定命令的帮助信息
  --wait                      提示用户在退出前按任意键
  --logs,--open-logs          打开默认日志位置
  --verbose,--verbose-logs    启用 WinGet 的详细日志记录
  --nowarn,--ignore-warnings  禁止显示警告输出
  --disable-interactivity     禁用交互式提示
  --proxy                     设置要用于此执行的代理
  --no-proxy                  禁止对此执行使用代理

可在此找到更多帮助: "https://aka.ms/winget-command-help"

WinGetApp.bat

@echo off
rem update:2025/8/8
set sourceName=cernet
rem 命令执行成功 ERRORLEVEL=0,失败 ERRORLEVEL<>0(一般cmd为1,但也有大于1,或为负数) 
winget source list --name %sourceName% > nul
if not ERRORLEVEL 0 (
  rem 添加国内源:https://help.mirrors.cernet.edu.cn/winget-source/,默认源
  winget source add --name %sourceName% https://mirrors.%sourceName%.edu.cn/winget-source --trust-level trusted
  rem 添加成功后,移除默认源 winget https://cdn.winget.microsoft.com/cache
  if ERRORLEVEL 0 winget source remove --name winget
)

rem 遍历所有入参,并执行
for %%a in (%*) do call :%%a %%a
goto batEnd

:help
echo ----------------------------------------------------
findstr /r /c:"^:" /c:"^set appList=" %~dpnx0
echo ----------------------------------------------------
goto :eof

:base
set appList=7zip.7zip Rizonesoft.Notepad3 QL-Win.QuickLook voidtools.Everything Microsoft.VCRedist.2015+.x64 zhongyang219.TrafficMonitor.Lite
for %%a in (%appList%) do winget install --id %%a
goto :eof

:baseExt
set appList=Microsoft.Edit FastCopy.FastCopy LIGHTNINGUK.ImgBurn agalwood.Motrix AntibodySoftware.WizTree cURL.cURL
for %%a in (%appList%) do winget install --id %%a
goto :eof

:av
set appList=Daum.PotPlayer NGWIN.PicPick XnSoft.XnViewMP NetEase.CloudMusic
for %%a in (%appList%) do winget install --id %%a
goto :eof

:avExt
rem --interactive 交互式安装,默认是静默式;--location 指定安装目录;--version 安装指定版本;--source sourceName 使用指定源
winget install --interactive --id Valve.Steam
goto :eof

:officeExt
set appList=Foxit.FoxitReader Kingsoft.PowerWord
for %%a in (%appList%) do winget install --id %%a
winget install --id Xmind.Xmind --version 23.8.2122
winget install --id iSlide.iSlide --version 6.3.2.1
goto :eof

:rp
set appList=DBeaver.DBeaver.Community Axure.AxureRP.11 JinweiZhiguang.Lanhu.Axure Google.Chrome
for %%a in (%appList%) do winget install --id %%a
goto :eof

:im
set appList=Tencent.WeChat.Universal Tencent.QQ.NT Tencent.WeCom
for %%a in (%appList%) do winget install --id %%a
goto :eof

:pscc2018runtime
set appList=Microsoft.VCRedist.2012.x64 Microsoft.VCRedist.2013.x64 Microsoft.VCRedist.2015+.x64
for %%a in (%appList%) do winget install --id %%a
goto :eof

:batEnd
echo.
rem Win11 自带:Microsoft.Edge、Microsoft.OneDrive、Microsoft.Teams、Microsoft.WindowsTerminal、
echo WinGet 没有:FileZilla、FreeFileSync、MusicBee、Rolan、
echo 历史版本更佳:Emurasoft.EmEditor、Piriform.CCleaner、appmakes.Typora、
echo 下载链接:https://pan.quark.cn/s/8f825b0f29b0 提取码:i4F3 ; https://dwz.islide.cc/offline 下载历史版本6
echo.
echo winget export -o d:\winGetOutput.json
echo.

发表回复

您的邮箱地址不会被公开。 必填项已用 * 标注