scoop使用
song

ScoopInstaller/Scoop: A command-line installer for Windows.
Home · ScoopInstaller/Scoop Wiki
scoop.sh

Scoop是Windows下的一个包管理器。

安装Scoop

安装scoop很简单,不过需要先确定一些基础环境是否符合安装要求

  • Windows 版本不低于 Windows 7
  • Windows 中的 PowerShell 版本不低于 PowerShell 5(或更高版本,包括PowerShell Core) 和.NET Framework 4.5(或更高版本)
  • 你能 正常、快速 的访问 GitHub 并下载上面的资源
  • 你的 Windows 用户名为英文(Windows 用户环境变量中路径值不支持中文字符)

打开非管理的PowerShell终端运行以下命令来安装Scoop:

1
2
3
#执行策略为远程脚本签名,范围为当前用户  默认自动同意
Set-ExecutionPolicy -ExecutionPolicy RemoteSigned -Scope CurrentUser -Force
Invoke-RestMethod -Uri https://get.scoop.sh | Invoke-Expression

[!tip]
PowerShell 执行策略必须是以下项之一: Unrestricted, RemoteSigned 或 ByPass 执行安装程序。
也可简化安装命令

1
irm get.scoop.sh | iex

如果您在访问 GitHub 时遇到网络问题,您可以使用代理,例如:

1
irm get.scoop.sh -Proxy 'http://<ip:port>' | iex

scoop默认安装在~\scoop 用户目录下面,如果要修改安装路径需提前配置用户环境变量后在执行安装

1
2
3
4
$env:SCOOP='D:\ScoopApps'  
## 设置用户变量SCOOP=D:\ScoopApps
[Environment]::SetEnvironmentVariable('SCOOP', $env:SCOOP, 'User')
irm get.scoop.sh | iex

配置scoop全局程序安装(sudo scoop install xxx -g)自定义目录 SCOOP_GLOBAL,默认全局目录是C:\ProgramData\scoop
配置SCOOP_GLOBAL需管理员权限

1
2
3
$env:SCOOP_GLOBAL='D:\GlobalScoopApps' 
##设置系统变量SCOOP_GLOBAL=D:\globalscoopapps
[Environment]::SetEnvironmentVariable('SCOOP_GLOBAL', $env:SCOOP_GLOBAL, 'Machine')

常用命令

命令 说明
search 搜索软件名
bucket 管理软件仓库
list 列出已安装软件
install 安装软件
update 更新软件
status 查看软件状态
uninstall 卸载软件
info 查看软件详细信息
home 打开软件主页
hold 锁定应用禁止升级
unhold 解除应用锁定

常用的应用程序桶

  • main - Default bucket which contains popular non-GUI apps.
  • extras - Apps that do not fit the main bucket’s criteria.
  • games - Open-source and freeware video games and game-related tools.
  • nerd-fonts - Nerd Fonts.
  • nirsoft - A collection of over 250+ apps from Nirsoft.
  • sysinternals - The Sysinternals suite from Microsoft.
  • java - A collection of Java development kits (JDKs) and Java runtime engines (JREs), Java’s virtual machine debugging tools and Java based runtime engines.
  • nonportable - Non-portable apps (may trigger UAC prompts).
  • php - Installers for most versions of PHP.
  • versions - Alternative versions of apps found in other buckets.

Scoop基础用法

列出 Scoop 已知的 bucket

1
2
3
4
5
6
7
8
9
10
11
scoop bucket known 
main
extras
versions
nirsoft
sysinternals
php
nerd-fonts
nonportable
java
games

添额外的存储桶

extras 这个存储桶,包含了大多数我们平常使用到的软件。

1
scoop bucket add extras 

搜索软件

1
scoop search <app>

安装软件

1
2
3
4
scoop install aria2
scoop install 7zip
scoop install git
scoop install snipaste typora vscode

全局安装软件

全局安装需要管理员权限,因为它们安装到\ProgramData\scoop,并设置系统环境变量。出于这个原因,需使用 sudo 命。

  1. 通过 Scoop 安装 sudo 工具。这个工具在 Windows 平台上模仿 Linux 的 sudo 命令,用于以管理员权限运行命令。
    1
    2
    3
    4
    5
    scoop install sudo
    ## 安装完成后,可以运行以下命令验证 sudo 是否可用
    ## sudo Get-ExecutionPolicy
    ## sudo notepad.exe
    ## sudo .\script.ps1
  2. 运行命令以管理员权限
    1
    sudo scoop install git --global
  3. 更新全局应用
    1
    sudo scoop update git -g

设置代理

1
2
3
scoop config proxy 127.0.0.1:10808
## scoop config proxy username:password@proxy.example.org:8080
## scoop config rm proxy 删除代理

开启aria2

1
2
3
scoop config aria2-enabled true
scoop config aria2-options --check-certificate=false
##scoop config aria2-enabled false

常用命令总结

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
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
# 显示 Scoop 的帮助信息
scoop help

# 更新 Scoop 本身和所有已安装的软件包
scoop update

# 检查 Scoop 的状态并诊断可能存在的问题
scoop status

# 搜索指定的软件包
scoop search <软件名>

# 查看软件包的详细信息
scoop info <软件名>

# 安装指定的软件包
scoop install <软件名>

# 从指定的仓库安装软件包
scoop install <bucket>/<软件名>

# 一次安装多个软件包
scoop install <软件1> <软件2>

# 列出所有已安装的软件包
scoop list

# 更新指定的软件包
scoop update <软件名>

# 卸载指定的软件包
scoop uninstall <软件名>

# 检查软件的安装状态是否正常
scoop check

# 冻结指定软件包的版本,不让其更新
scoop hold <软件名>

# 解冻指定软件包,允许其更新
scoop unhold <软件名>

# 查看已添加的仓库列表
scoop bucket list

# 添加新的官方或社区仓库
scoop bucket add <仓库名>

# 添加自定义仓库(需提供 URL)
scoop bucket add <仓库名> <URL>

# 删除已添加的仓库
scoop bucket rm <仓库名>

# 更新所有仓库信息
scoop bucket update

# 显示当前的缓存文件
scoop cache show

# 清除指定软件包的缓存文件
scoop cache rm <软件名>

# 清除所有缓存文件
scoop cache rm *

# 以全局方式安装软件包(需管理员权限)
scoop install -g <软件名>

# 卸载全局安装的软件包
scoop uninstall -g <软件名>

# 检查 Scoop 的配置和已安装软件包的状态
scoop check

# 修复 Scoop 和软件包的常见问题
scoop repair

# 设置 Scoop 的代理服务器
scoop config proxy <http://proxy-url:port>

# 查看当前代理设置
scoop config proxy

# 禁用 Scoop 的代理
scoop config proxy none

# 查看当前 Scoop 配置
scoop config

# 禁用 Aria2 作为下载工具(使用默认的单线程下载)
scoop config aria2-enabled false

# 设置全局安装的目录
scoop config SCOOP_GLOBAL <路径>

# 安装多个常用工具
scoop install git 7zip curl

# 添加额外的仓库(如社区仓库)
scoop bucket add extras
scoop bucket add versions

# 更新所有内容,包括 Scoop 本身和所有软件包
scoop update *

# 清理所有缓存文件并修复环境
scoop cache rm *
scoop repair

由 Hexo 驱动 & 主题 Keep