Windows 命令行包管理工具scoop的使用
参考资料
- 全Scoopコマンド解説 その1 ~使用頻度(高)~
- 個人的によく使うScoopコマンド
- WindowsコマンドラインツールScoopのすすめ(バージョン管理編)
- scoop中使用aria2加速下载
目录
- 一. 简介
- 1.1 安装
- 1.1.1 默认安装
- 1.1.2 安装到指定目录下
- 1.1.3 安装后修改安装目录
- 1.2 目录结构
- 1.3 国内使用
- 1.3.1 使用国内 Bucket 镜像
- 1.3.2 使用Aria2开启多线程下载
- 1.3.3 设置代理
- 二. scoop常用操作
- 2.1 bucket
- 2.2 检索
- 2.3 安装
- 2.3.1 命令行工具
- 2.3.2 软件开发环境
- 2.4 查看
- 2.4.1 查看scoop的整体状态
- 2.4.2 查看已经安装的所有软件
- 2.4.3 查看指定软甲的相关信息
- 2.4.4 查看软件的安装位置
- 2.4.5 查看所有的shim
- 2.4.6 查看当前使用的命令的路径
- 2.5 更新
- 2.6 版本管理
- 2.7 卸载
- 2.8 导入与导出
- 三. 别名配置
一. 简介
🔷Scoop是一个开源的 Windows 包管理器,通过用命令行管理开发工具,类似于Linux的apt 和 macOS的Homebrew。
- 官方Github仓库:
https://github.com/ScoopInstaller/Scoop
1.1 安装
1.1.1 默认安装
🔷通过Powershell进行安装
Set-ExecutionPolicy-ExecutionPolicy RemoteSigned-Scope CurrentUserInvoke-RestMethod-Uri https://get.scoop.sh|Invoke-Expression🔷安装成功之后,会默认将当前用户的scoop\shims目录添加到用户环境变量中
1.1.2 安装到指定目录下
- 先配置环境变量,指定安装位置后,再执行安装命令
# 当前用户系统变量[Environment]::SetEnvironmentVariable('SCOOP','D:\Scoop',[EnvironmentVariableTarget]::User)# 系统变量[Environment]::SetEnvironmentVariable('SCOOP','D:\Scoop',[EnvironmentVariableTarget]::Machine)Set-ExecutionPolicy-ExecutionPolicy RemoteSigned-Scope CurrentUserInvoke-RestMethod-Uri https://get.scoop.sh|Invoke-Expression1.1.3 安装后修改安装目录
🔷如果C盘空间吃紧,或者当前用户名含有汉字的情况下,可以将scoop目录移动到其他磁盘中。
- 找到原目录后,直接剪切走即可
- 然后修改环境变量
1.2 目录结构
🔷默认会安装在当前用户的scoop目录下
- apps:用于存放安装的软件
- buckets:软件仓库,默认的仓库是main,可自行添加
- cache:缓存
- persist:存放软件配置,用来保证软件升级后不丢失配置
🔷shims:
当通过 Scoop 安装一个命令行工具(如git)时,Scoop 并不会修改系统的PATH环境变量来直接指向该工具的实际可执行文件(.exe)。
Scoop 会在shims目录下创建一个同名的、轻量级的可执行文件(.exe)。系统PATH环境变量中只需添加~\scoop\shims这一个路径。
当运行命令(例如git)时,系统会先找到shims目录下的git.exe,这个git.exe程序会负责定位并启动apps目录下对应软件的真实git.exe。
7z.shim实际指向的是apps目录下的7z.exe
1.3 国内使用
1.3.1 使用国内 Bucket 镜像
- scoop国内镜像优化库:
https://gitee.com/scoop-installer/scoop
# 删除默认的main所关联的仓库scoop bucketrmmain# 添加国内的镜像库scoop bucketaddmain https://gitee.com/scoop-installer/main.git scoop bucketaddextras https://gitee.com/scoop-installer/extras.git scoop bucketaddversions https://gitee.com/scoop-installer/versions.git1.3.2 使用Aria2开启多线程下载
- 下载并启用之后,下载大型软件的话,可以提升下载速度
scoopinstallaria2 scoop config aria2-enabledtrue- 查看配置
PSF:\> scoop config last_update scoop_repo scoop_branch aria2-enabled----------------------------------------------2026/5/31 13:18:38 https://github.com/ScoopInstaller/Scoop master True1.3.3 设置代理
- 如果有条件的话,可以使用代理
# 设置代理scoop config proxy http://127.0.0.1:7890# 查看代理scoop config proxy# 删除代理scoop configrmproxy二. scoop常用操作
2.1 bucket
- 列出所有可安装的bucket
PS F:\>scoop bucket known main extras versions nirsoft sysinternals php nerd-fonts nonportablejavagames PS F:\>- 列出已经安装的bucket
PS F:\>scoop bucket list Name Source Updated Manifests ---- ------ ------- --------- main https://github.com/ScoopInstaller/Main.git2026/5/315:38:291552extras https://github.com/ScoopInstaller/Extras2026/5/313:20:122304versions https://github.com/ScoopInstaller/Versions2026/5/316:18:08586- 添加指定的bucket
scoop bucketaddextras scoop bucketaddversions scoop bucketaddjava- 移除指定的bucket
scoop bucketrmjava2.2 检索
PS F:\>scoop searchgrepResults fromlocalbuckets... Name Version Source Binaries ---- ------- ------ -------- ast-grep0.43.0 main gettext1.0-v1.19 main msggrep.exe gow0.8.0 main egrep.exe|fgrep.exe|grep.exegrep3.11main igrep1.3.0 main jsongrep0.9.0 main nim2.2.10 main nimgrep.exe pcre2grep10.39main pcregrep8.45main repgrep0.16.1 main rga0.10.9 main ripgrep-all.exe ripgrep15.1.0 main rktools2k31.0main qgrep.exe ugrep7.8.2 main unxutils2007.03.01 main agrep.exe|egrep.exe|fgrep.exe|grep.exe astrogrep4.4.9 extras baregrep3.50a extras dngrep4.7.54.0 extras grepwin2.1.12 extras roughgrep3.16.2 extras2.3 安装
2.3.1 命令行工具
🔷所有的安装包都依赖于7zip解压缩,属于必安装的软件
scoopinstall7zip🔷coreutils提供了大多数常用的命令行工具
scoopinstalllessscoopinstalltouchscoopinstallcoreutils🔷文本处理3剑客
scoopinstallgrepscoopinstallgawkscoopinstallsed🔷更加现代化的命令行工具
ripgrep用于代替grepfd用于代替find,在windows中使用的话,find会乱码bat用于代替cateza用于代替ls
scoopinstallripgrep scoopinstallfd scoopinstallbat scoopinstalleza2.3.2 软件开发环境
scoopinstallsudoscoopinstallvscode scoopinstalleclipse-java scoopinstallnotepadplusplusscoopinstallpython313 scoopinstallpython314 scoopinstallnodejs22 scoopinstallnodejs24scoopinstallopenjdk17 scoopinstallopenjdk212.4 查看
2.4.1 查看scoop的整体状态
PS F:\>scoop status Scoop is up to date. Everything is ok!2.4.2 查看已经安装的所有软件
PS F:\>scoop list Installed apps: Name Version Source Updated Info ---- ------- ------ ------- ---- 7zip26.01main2026-05-3014:00:24 bat0.26.1 main2026-05-31 08:29:50 coreutils5.97.3 main2026-05-3014:22:33 eza0.23.4 main2026-05-3019:40:30 fd10.4.2 main2026-05-3019:23:59 ripgrep15.1.0 main2026-05-3020:01:15sudo0.2020.01.26 main2026-05-3015:17:11touch0.2018.07.25 main2026-05-31 08:28:362.4.3 查看指定软甲的相关信息
PS F:\>scoop info 7zip Name:7zip Description:A multi-formatfilearchiver with high compression ratios. Version:26.01Source:main Website:https://www.7-zip.org License:BSD-2-Clause, BSD-3-Clause, LGPL-2.1-or-later Updated at:2026/4/281:55:41 Updated by:github-actions[bot]Installed:26.01Binaries:7z.exe|7zG.exe|7zFM.exe Shortcuts:7-Zip\7-Zip File Manager|7-Zip\7-Zip Help Notes:To register the context menu entry, please execute the following command: regimport"<root>\install-context.reg"If an error occurswhileattempting to delete files during uninstallation, run the followingcommandandthenretry: Stop-Process-Name'explorer'2.4.4 查看软件的安装位置
PS F:\>scoop prefix 7zip C:\Users\用户名\scoop\apps\7zip\current2.4.5 查看所有的shim
PS F:\>scoop shim list|headName Source Alternatives IsGlobal IsHidden ---- ------ ------------ -------- -------- 7z External False True 7zfm External False True 7zg External False TruebasenameExternal False True bat External False TruecatExternal False TruechmodExternal False True2.4.6 查看当前使用的命令的路径
- 若系统中有多个版本的grep命令的话,使用
scoop which,可以明确当前使用的grep安装路径
PS F:\>scoopwhichgrepC:\Program Files\Git\usr\bin\grep.exe2.5 更新
- 更新
scoop自身,查看是否有软件可更新
PS F:\>scoop update Updating Scoop... Updating Buckets... Scoop was updated successfully!- 更新指定的软件
PS F:\>scoop update 7zip 7zip:26.01(latest version)Latest versionsforall apps are installed!Formoreinformation try'scoop status'2.6 版本管理
🔷当安装了多个版本的软件后,可通过reset命令切换版本。
scoop reset python版本
2.7 卸载
# 卸载scoop uninstall findutils# 清除缓存scoop cachermfindutils2.8 导入与导出
# 将安装的软件列表导出scoopexport>scoop.json# 依据导出的软件列表导入软甲scoopimportscoop.json三. 别名配置
🔷Windows使用的是Powershell7,在C:\Users\用户名\Documents\PowerShell\profile.ps1的路径中新建profile.ps1文件。
- 创建
ll函数,用来封装eza命令 - 文件夹优先,并且显示详细
functionll{$eza=Join-Path$env:SCOOP'shims\eza.exe'&$eza`-lah `--group-directories-first ` @args}