winget

winget

一、 winget安装

  1. 执行命令检测是否存在winget

    winget
    

    在这里插入图片描述

  2. 不存在执行命令安装 winget

    #请从 Windows PowerShell 命令提示符执行以下步骤:
    $progressPreference = 'silentlyContinue'
    Write-Information "Downloading WinGet and its dependencies..."
    Invoke-WebRequest -Uri https://aka.ms/getwinget -OutFile Microsoft.DesktopAppInstaller_8wekyb3d8bbwe.msixbundle
    Invoke-WebRequest -Uri https://aka.ms/Microsoft.VCLibs.x64.14.00.Desktop.appx -OutFile Microsoft.VCLibs.x64.14.00.Desktop.appx
    Invoke-WebRequest -Uri https://github.com/microsoft/microsoft-ui-xaml/releases/download/v2.7.3/Microsoft.UI.Xaml.2.7.x64.appx -OutFile Microsoft.UI.Xaml.2.7.x64.appx
    Add-AppxPackage Microsoft.VCLibs.x64.14.00.Desktop.appx
    Add-AppxPackage Microsoft.UI.Xaml.2.7.x64.appx
    Add-AppxPackage Microsoft.DesktopAppInstaller_8wekyb3d8bbwe.msixbundle
    

二、 winget配置 非必须配置项

  1. winget ,tab键补全功能 只有在 powershell 窗口可以用

    # 在命令窗口执行如下命令
    notepad.exe $PROFILE
    
    # 打开的文件中天添加如下命令
    Register-ArgumentCompleter -Native -CommandName winget -ScriptBlock {
        param($wordToComplete, $commandAst, $cursorPosition)
            [Console]::InputEncoding = [Console]::OutputEncoding = $OutputEncoding = [System.Text.Utf8Encoding]::new()
            $Local:word = $wordToComplete.Replace('"', '""')
            $Local:ast = $commandAst.ToString().Replace('"', '""')
            winget complete --word="$Local:word" --commandline "$Local:ast" --position $cursorPosition | ForEach-Object {
                [System.Management.Automation.CompletionResult]::new($_, $_, 'ParameterValue', $_)
            }
    }
    

    在这里插入图片描述
    在这里插入图片描述

    2.自定义样式

    # cmd 命令窗口执行 
    winget settings
    
    # 自定义配置文件   portablePackageUserRoot 自定义配置  
    {
        "$schema": "https://aka.ms/winget-settings.schema.json",
    
        // For documentation on these settings, see: https://aka.ms/winget-settings
        "source": {
           "autoUpdateIntervalInMinutes": 5
         },
     "experimentalFeatures": {
    	  "dependencies": true,
    	  "directMSI": false,
    	  "zipInstall": false,
        },
        "visual": {
            "progressBar": "rainbow"
        },
    "installBehavior": {
            "portablePackageUserRoot": "D:/Download/Packages",
            "portablePackageMachineRoot": "C:/Download/Packages/Portable",
           "preferences": {
                    "scope": "machine"
           },
            "purgePortablePackage": true
        },
    "logging": {
        "level": "info"
    }
    }
    

在这里插入图片描述

三、安装卸载命令

  1. 帮助命令

    winget --help
    winget install --help
    winget  list  --help 
    ....
    # --help 可以查看操作参数
    
  2. 安装命令

    # 查询所需要的镜像源 -name 表示根据名称查询
    winget search --name 网易云音乐
    # 安装软件 --id 表示根据id匹配, -L 表示安装地点
    winget install --id Tencent.QOMusic -l D:Download\QOMusic
    

在这里插入图片描述
在这里插入图片描述

  1. 卸载命令

    #查询要卸载的软件,查询所有
    winget list 
    #根据名称 查询自己已经安装的软件
    winget list --name 音乐
    #卸载软件 --id 根据id 卸载软件
    winget uninstall --id 网易云音乐
    

    在这里插入图片描述
    在这里插入图片描述
    在这里插入图片描述

评论 1
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值