Scoop

优雅地在Windows中管理apps

目录

scoop是什么

官方wiki 是这样写的,但是可以将其比作类似于 apt aur 的包管理器

Scoop is an installer The goal of Scoop is to let you use Unix-y programs in a normal Windows environment Scoop 是一个安装程序 Scoop 的目标是让你能在普通 Windows 环境中使用 Unix 程序

shim 垫片

在 Windows 环境中, shim 垫片 是 Scoop 实现其设计哲学的技术手段。 在传统的 Windows 软件安装中,为了在命令行直接运行程序(例如输入 python),通常有两种做法:

  • Windows的普通做法:将软件的安装路径(如 C:\Software\Python310)直接添加到系统的环境变量 Path 中。
  • 问题:如果安装了 100 个软件,Path 变量会变得臃肿不堪,且容易发生版本冲突。

Scoop 的做法: 它不修改你的 Path 变量,而是只在 Path 中保留一个统一的目录(通常是 ~/scoop/shims)。在这个目录下,Scoop 为每个软件创建了一个同名的微型 .exe 文件,这就是垫片。

图表 代码
graph TD
    User([用户输入 picgo]) --> Shell[终端 PowerShell/CMD]
    Shell --> PathLookup{在 Path 变量中搜索}
    PathLookup -->|仅需检查一个目录| ShimsDir[C:\Users\EMANON\scoop\shims]
    ShimsDir -->|找到垫片| ShimExe[picgo.exe 垫片程序]

    subgraph Scoop_Internal [Scoop 内部逻辑]
    ShimExe -->|读取配置| ShimConfig[picgo.shim]
    ShimConfig -->|指向当前激活版本| CurrentLink[.../apps/picgo/current/PicGo.exe]
    end

    CurrentLink -->|透明启动| RealApp[运行 PicGo 真实程序]
    RealApp --> Result([程序执行结果])
graph TD
    User([用户输入 picgo]) --> Shell[终端 PowerShell/CMD]
    Shell --> PathLookup{在 Path 变量中搜索}
    PathLookup -->|仅需检查一个目录| ShimsDir[C:\Users\EMANON\scoop\shims]
    ShimsDir -->|找到垫片| ShimExe[picgo.exe 垫片程序]

    subgraph Scoop_Internal [Scoop 内部逻辑]
    ShimExe -->|读取配置| ShimConfig[picgo.shim]
    ShimConfig -->|指向当前激活版本| CurrentLink[.../apps/picgo/current/PicGo.exe]
    end

    CurrentLink -->|透明启动| RealApp[运行 PicGo 真实程序]
    RealApp --> Result([程序执行结果])
graph TD
    User([用户输入 picgo]) --> Shell[终端 PowerShell/CMD]
    Shell --> PathLookup{在 Path 变量中搜索}
    PathLookup -->|仅需检查一个目录| ShimsDir[C:\Users\EMANON\scoop\shims]
    ShimsDir -->|找到垫片| ShimExe[picgo.exe 垫片程序]

    subgraph Scoop_Internal [Scoop 内部逻辑]
    ShimExe -->|读取配置| ShimConfig[picgo.shim]
    ShimConfig -->|指向当前激活版本| CurrentLink[.../apps/picgo/current/PicGo.exe]
    end

    CurrentLink -->|透明启动| RealApp[运行 PicGo 真实程序]
    RealApp --> Result([程序执行结果])
 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
graph TD
    User([用户输入 picgo]) --> Shell[终端 PowerShell/CMD]
    Shell --> PathLookup{在 Path 变量中搜索}
    PathLookup -->|仅需检查一个目录| ShimsDir[C:\Users\EMANON\scoop\shims]
    ShimsDir -->|找到垫片| ShimExe[picgo.exe 垫片程序]

    subgraph Scoop_Internal [Scoop 内部逻辑]
    ShimExe -->|读取配置| ShimConfig[picgo.shim]
    ShimConfig -->|指向当前激活版本| CurrentLink[.../apps/picgo/current/PicGo.exe]
    end

    CurrentLink -->|透明启动| RealApp[运行 PicGo 真实程序]
    RealApp --> Result([程序执行结果])

current 目录: 这是 Scoop 实现环境变量中转的神来之笔。

  • Scoop 不会直接让垫片指向 apps/picgo/2.4.3/PicGo.exe。
  • 它会创建一个名为 current 的软链接,指向当前激活的版本文件夹。
  • 垫片 -> current -> 真实程序。当升级软件时,Scoop 只需要把 current 重新指向 2.4.4 文件夹,而无需修改任何垫片或环境变量。
图表 代码
graph LR
    subgraph User_Space [环境变量层]
    Path[System Path] --- Shim[picgo.exe Shim]
    end

    subgraph Logic_Layer [逻辑映射层]
    Shim -.-> Current((current 软链接))
    end

    subgraph Version_Storage [物理存储层]
    Current ==> V243[Version 2.4.3 文件夹]
    Current -.-> V250[Version 2.5.0-beta 文件夹]
    end

    style V243 fill:#f9f,stroke:#333,stroke-width:2px
    style V250 fill:#bbf,stroke:#333,stroke-width:1px
graph LR
    subgraph User_Space [环境变量层]
    Path[System Path] --- Shim[picgo.exe Shim]
    end

    subgraph Logic_Layer [逻辑映射层]
    Shim -.-> Current((current 软链接))
    end

    subgraph Version_Storage [物理存储层]
    Current ==> V243[Version 2.4.3 文件夹]
    Current -.-> V250[Version 2.5.0-beta 文件夹]
    end

    style V243 fill:#f9f,stroke:#333,stroke-width:2px
    style V250 fill:#bbf,stroke:#333,stroke-width:1px
graph LR
    subgraph User_Space [环境变量层]
    Path[System Path] --- Shim[picgo.exe Shim]
    end

    subgraph Logic_Layer [逻辑映射层]
    Shim -.-> Current((current 软链接))
    end

    subgraph Version_Storage [物理存储层]
    Current ==> V243[Version 2.4.3 文件夹]
    Current -.-> V250[Version 2.5.0-beta 文件夹]
    end

    style V243 fill:#f9f,stroke:#333,stroke-width:2px
    style V250 fill:#bbf,stroke:#333,stroke-width:1px
 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
graph LR
    subgraph User_Space [环境变量层]
    Path[System Path] --- Shim[picgo.exe Shim]
    end

    subgraph Logic_Layer [逻辑映射层]
    Shim -.-> Current((current 软链接))
    end

    subgraph Version_Storage [物理存储层]
    Current ==> V243[Version 2.4.3 文件夹]
    Current -.-> V250[Version 2.5.0-beta 文件夹]
    end

    style V243 fill:#f9f,stroke:#333,stroke-width:2px
    style V250 fill:#bbf,stroke:#333,stroke-width:1px

安装

Scoop 官网有介绍,在终端运行以下两条命令就可以:

1
2
Set-ExecutionPolicy -ExecutionPolicy RemoteSigned -Scope CurrentUser
Invoke-RestMethod -Uri https://get.scoop.sh | Invoke-Expression

优点

  1. 环境纯净:不修改注册表,不污染 Windows 环境。删除应用时,直接删除文件夹即可,不留注册表垃圾。
  2. 安装自动化:安装应用时无需手动“下一步”,Scoop 社区已经写好了安装脚本,一键执行。
  3. 更新方便:可以方便地手动更新所有应用到最新版。在我看来,Windows 上的应用多更新利大于弊,能避免很多问题(比如我最近遇到 v2ray 旧版被ufw识别的风险,以及旧版 QQ 发文件对方看不到等问题)。
  4. 数据持久化:使用 uninstall 命令卸载应用会保留数据,但是可以使用 scoop uninstall --purge <app_name> 命令完全删除。
  5. 快速切换应用版本。
  6. 不用担心下载到盗版 steam。
  7. 在官方wiki 中,scoop 的设计目标是让人快速工作,而不是浪费时间在寻找软件、查看说明、安装上面。

设置代理

1
scoop config proxy 127.0.0.1:7890 # 如果是使用clash系,就是7890端口,如果是 v2rayn 就是 10808 端口

不设置代理也行,需要设置镜像站,但是这样更新就会慢点。具体可以看文末

我用 bucket:

1
2
3
4
5
6
7
main       https://github.com/ScoopInstaller/Main.git         2025/12/26 12:32:43      1412  # 自带的
extras     https://github.com/ScoopInstaller/Extras           2025/12/26 12:32:11      2235 # 必装,覆盖大部分日用软件
nerd-fonts https://github.com/matthewjberger/scoop-nerd-fonts 2025/12/15 17:39:10       367 # 安装字体
java       https://github.com/ScoopInstaller/Java             2025/12/5 4:25:04         324 # 安装Java
games      https://github.com/Calinou/scoop-games             2025/12/26 12:31:57       370 # 安装 steam,epic
dorado     https://github.com/chawyehsu/dorado                2025/12/26 8:18:09        265 # 安装国产软件
lemon      https://github.com/hoilc/scoop-lemon               2025/12/26 11:59:05      2321 # 包含了很多的GitHub小工具,小项目

至于怎么导入呢?点击bucket的链接,里面会有导入说明的。

我用的推荐必装的软件

  • sudo
    • 一些软件安装需要调用管理员权限,安装后可以像Linux一样使用而不是额外开一个管理员终端。
  • scoop-search
    • 优化搜索体验,scoop 自带的搜索太慢了,而且显示信息太少。scoop-search 可以提高搜索速度,并且显示软件的历史版本。
    • 安装后,将 hook 命令加入 .PROFILE 文件就可以替代原来的scoop 搜索了。
  • aria2
    • 多线程下载,优化scoop 的下载速度。
    • 安装后使用scoop config aria2-enabled true命令开启 aria2。
  • scoop-completion
    • 补全 scoop 的命令。

主要命令

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
alias      Manage scoop aliases 管理 Scoop 别名
bucket     Manage Scoop buckets 管理 Scoop 软件仓库(Bucket)
cache      Show or clear the download cache 显示或清理下载缓存
cat        Show content of specified manifest. If available, `bat` will be used to pretty-print the JSON. 显示指定清单的内容。如果系统安装了 `bat`,将用于美化 JSON 输出。
checkup    Check for potential problems 检查潜在的系统问题
cleanup    Cleanup apps by removing old versions 通过移除旧版本来清理已安装的应用
config     Get or set configuration values 获取或设置配置值
create     Create a custom app manifest 创建自定义应用清单
depends    List dependencies for an app, in the order they'll be installed 按安装顺序列出应用的依赖项
download   Download apps in the cache folder and verify hashes 下载应用至缓存目录并校验哈希值
export     Exports installed apps, buckets (and optionally configs) in JSON format 以 JSON 格式导出已安装的应用、仓库(及可选的配置)
help       Show help for a command 显示命令的帮助信息
hold       Hold an app to disable updates 锁定应用以禁用更新
home       Opens the app homepage 打开应用的主页
import     Imports apps, buckets and configs from a Scoopfile in JSON format 从 JSON 格式的 Scoopfile 导入应用、仓库和配置
info       Display information about an app 显示关于应用的详细信息
install    Install apps 安装应用
list       List installed apps 列出已安装的应用
prefix     Returns the path to the specified app 返回指定应用的安装路径
reset      Reset an app to resolve conflicts 重置应用以解决冲突
search     Search available apps 搜索可用的应用
shim       Manipulate Scoop shims 操作 Scoop 的垫片程序
status     Show status and check for new app versions 查看状态并检查应用是否有新版本
unhold     Unhold an app to enable updates 解锁应用以启用更新
uninstall  Uninstall an app 卸载应用
update     Update apps, or Scoop itself 更新应用或 Scoop 自身
virustotal Look for app's hash or url on virustotal.com 在 virustotal.com 上查询应用的哈希值或链接
which      Locate a shim/executable (similar to 'which' on Linux) 定位垫片程序或可执行文件(类似于 Linux 中的 which 命令)

这些命令看着多,其实也不需要怎么记。当真正用得到的时候,就不会忘记了。所以最好对功能有个大概的了解。

新手只要会这几个命令就好了

  • scoop search <app>: 寻找软件。
  • scoop install <app>: 安装软件。
  • scoop update *: 一键更新所有软件及 Scoop 本身。
  • scoop checkup: 当运行异常时,这是排查环境问题的首选。
  • scoop reset <app>:注册表异常或者安装时未正常退出导致的应用异常。
  • scoop uninstall <app>:卸载应用,注意这不会删除所有有关的包(这样设计以便快速回退),如果需要删除缓存需要使用 scoop cleanup <app>。

还有就是要注意应用安装完成后,一些软件需要修改注册表的(关联文件类型启动,右键菜单),会给一串命令需要管理员身份手动运行。 还有一些软件依赖其他的驱动,不能直接安装的,需要你在对应路径安装对应 exe。 有时候没注意到命令就关闭可命令行,其实也不用着急,输入 scoop info app-name ,就可以看到脚本的note 了。

吐槽一下

我使用scoop 安装了picgo 这个图床软件,遇到了一些问题。 旧版的 scoop,无法在线安装插件。 新版的 scoop 却是测试版(已经测试了快一年了)。但是 bucket却不会收录测试版的应用。所以自己 fork 后push 也不会被合并。 之前下载的 Epic Games 启动也有点问题。

有几种办法:

  • 自己下载安装包下载(其实也不费事)。
  • 使用 scoop create <app-url>自己写一个JSON,然后 scoop install app.json。
  • 创建一个自己的bucket。

参考

  1. Scoop——也许是Windows平台最好用的软件(包)管理器
  2. Home · ScoopInstaller/Scoop Wiki · GitHub