Windows 系统下的包管理器 Scoop

powershell

scoop uninstall scoop

先允许 Powershell 执行本地脚本

powershell

set-executionpolicy remotesigned -scope currentuser

安装 scoop

powershell

$env:SCOOP='D:\Scoop'

# 先添加用户级别的环境变量 SCOOP
[environment]::setEnvironmentVariable('SCOOP',$env:SCOOP,'User')

# 下载安装 Scoop 
irm get.scoop.sh | iex

设置全局安装路径(官方文档不推荐)

powershell

$env:SCOOP_GLOBAL='D:\GlobalScoopApps'

[environment]::setEnvironmentVariable('SCOOP_GLOBAL',$env:SCOOP_GLOBAL,'Machine')

# 取消
[Environment]::SetEnvironmentVariable('SCOOP_GLOBAL', $null, 'Machine')

powershell

# 但 scoop 进行全局安装时需要使用到 sudo 命令
scoop install sudo

# scoop下载程序时支持使用 aria2 来加速下载
scoop install aria2

# 命令补全
scoop install scoop-completion

powershell

scoop help           # 查看帮助
scoop help <某个命令> # 具体查看某个命令的帮助

scoop install <app>   # 安装 APP
scoop uinstall <app>  # 卸载 APP

scoop list   # 列出已安装的 APP
scoop search # 搜索 APP
scoop status # 检查哪些软件有更新

scoop update               # 更新 Scoop 自身
scoop update <app1> <app2> # 更新某些app
scoop update *             # 更新所有 app (前提是需要在apps目录下操作)

scoop bucket known          # 通过此命令列出已知所有 bucket(软件源)
scoop bucket add bucketName # 添加某个 bucket

scoop cache rm <app> # 移除某个app的缓存

powershell

# 安装之前,通过 search 搜索 APP, 确定软件名称
scoop search  xxx

# 安装 APP
scoop install <app>

# 安装特定版本的 APP;语法 AppName@[version],示例
scoop install git@2.23.0.windows.1

# 卸载 APP 
scoop uninstall <app> #卸载 APP

powershell

# 更新 Scoop 自身
scoop update

# 更新某些app
scoop update appName1 appName2

# 更新所有 app (可能需要在apps目录下操作)
scoop update *

# 禁止某程序更新
scoop hold <app>

# 允许某程序更新
scoop unhold <app>

powershell

# 查看所有以下载的缓存信息
scoop cache show

# 清除指定程序的下载缓存
scoop cache rm <app>

# 清除所有缓存
scoop cache rm *

# 删除某软件的旧版本
scoop cleanup <app>

# 删除全局安装的某软件的旧版本
scoop cleanup <app> -g

# 删除过期的下载缓存
scoop cleanup <app> -k

powershell

scoop reset [app]@[version]

powershell

# 显示某个app的信息
scoop info <app>

# 在浏览器中打开某app的主页
scoop home <app>

# 比如
scoop home git

Scoop 默认的 Bucket 为 main ;官方维护的另一个 Bucket 为 extras,我们需要手动添加

powershell

# bucket的用法
scoop bucket add|list|known|rm [<args>]

# 添加extras
scoop bucket add extras

powershell

scoop bucket add extras
scoop bucket add dorado https://github.com/h404bi/dorado
scoop bucket add Ash258 https://github.com/Ash258/Scoop-Ash258

powershell

scoop export > ~\scoop.json
scoop import ~\scoop.json