前言

在我不小心从 Win10 升级到 Win 11 后,电脑开启软件经常有卡顿感,而且还频频出现各种兼容性问题,在最后我备份好数据重装系统。
不过重装系统,最开始的步骤是最让人头疼的,需要去各种官网去找各种软件并安装配置。更令我害怕的是我会忘记去用那些好用的软件 (主要是到时候懒得去装和配置),所以我决定把我常用的软件都整理一下,用 winget 和 scoop 来安装,再用一些自用的脚本把配置也一并安装好,将重装系统后软件安装的过程变成一种享受。

1. 软件包管理工具

每款软件的官网都不同,软件下载入口也不一样,去找这些软件是个比较痛苦的过程。所以这里我用到了 winget 和 scoop 两款软件,两者各有特点,都会使用到。

1.1 WinGet

WinGet 是微软官方程序安装包开源管理工具,版本2004之后都已经内置,装完机后即用

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
> winget
Windows 程序包管理器 v1.3.2691
版权所有 (C) Microsoft Corporation。保留所有权利。

WinGet 命令行实用工具可从命令行安装应用程序和其他程序包。

使用情况: winget [<命令>] [<选项>]

下列命令有效:
install 安装给定的程序包
show 显示包的相关信息
source 管理程序包的来源
search 查找并显示程序包的基本信息
list 显示已安装的程序包
upgrade 显示并执行可用升级
uninstall 卸载给定的程序包
hash 哈希安装程序的帮助程序
validate 验证清单文件
settings 打开设置或设置管理员设置
features 显示实验性功能的状态
export 导出已安装程序包的列表
import 安装文件中的所有程序包

如需特定命令的更多详细信息,请向其传递帮助参数。 [-?]

下列选项可用:
-v,--version 显示工具的版本
--info 显示工具的常规信息

可在此找到更多帮助: https://aka.ms/winget-command-help

1.2 Scoop

Scoop 是一个开源的包管理工具,安装软件速度依赖于访问 github 的速度,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
29
30
31
32
33
34
35
36
37
> scoop
Usage: scoop <command> [<args>]

Available commands are listed below.

Type 'scoop help <command>' to get more help for a specific command.

Command Summary
------- -------
alias Manage scoop aliases
bucket Manage Scoop buckets
cache Show or clear the download cache
cat Show content of specified manifest. If available, `bat` will be used to pretty-print the 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
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
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
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
virustotal Look for app's hash or url on virustotal.com
which Locate a shim/executable (similar to 'which' on Linux)

1.3 两者对比

wingetscoop
维护团队微软和社区社区
索引更新GIT 增量缓存HTTP 全量缓存
维护团队微软和社区社区
下载文件.zip压缩包.exe 或者 .msi 安装程序
桌面应用相对少大厂软件基本都有

可见两者范围不同,例如像 7zip 这类不太需要注册表的软件就可以用 Scoop 来安装,像 QQ Steam 这类可能开机启用,Vscode 这类需要加注册表的软件就可以用 winget 来安装。

2. 软件安装

2.1 winget

winget 下载默认是会走系统代理的,并且没有类似 --proxy 这样的参数设置代理,所以在使用前确定自己是否配置好了系统代理,否则很多软件会出现下载失败的情况。

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
# 更新 winget 源
winget source update

# 日常使用和开发工具
winget install -e --id Fndroid.ClashForWindows --force # Clash For Windows
winget install -e --id Google.Chrome --force # Chrome 游览器
winget install -e --id Microsoft.PowerToys --force # Windows 工具箱
winget install -e --id Microsoft.PowerShell --force # PowerShell 升级版
winget install -e --id Microsoft.WindowsTerminal --force # Windows 终端最新版
winget install -e --id SoftDeluxe.FreeDownloadManager --force # 下载器
winget install -e --id qBittorrent.qBittorrent --force # BT 下载器
winget install -e --id Baidu.BaiduNetdisk --force # 百度网盘

# 社交&娱乐
winget install -e --id Telegram.TelegramDesktop --force # Telegram
winget install -e --id Discord.Discord --force # Discord
winget install -e --id Tencent.WeChat --force # 微信
winget install -e --id Tencent.QQ --force # QQ
winget install -e --id Valve.Steam --force # steam
winget install -e --id Daum.PotPlayer --force # 视频播放器

# 开发工具
winget install -e --id Microsoft.VisualStudioCode --force # VSCode
winget install -e --id Docker.DockerDesktop --force # Docker
winget install -e --id NickeManarin.ScreenToGif --force # 屏幕录制
winget install -e --id Telerik.Fiddler.Classic --force # 抓包工具
winget install -e --name Snipaste --force # 截图工具

# 硬件相关
winget install -e --id CrystalDewWorld.CrystalDiskInfo.ShizukuEdition # 硬盘检测
winget install -e --id Logitech.GHUB # Logitech 驱动

2.2 scoop

scoop 默认源的软件都来源于 github,没有设置代理将会无法下载,可通过 scoop config proxy 127.0.0.1:7890 来设置代理。

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
# 先使用powershell查看脚本执行策略 (默认是Restricted)
ExecutionPolicy RemoteSigned -Scope CurrentUser

# 简短方式安装 scoop
iwr -useb get.scoop.sh | iex # 或者正常安装 Invoke-Expression (New-Object System.Net.WebClient).DownloadString('https://get.scoop.sh')

# 安装常用软件
scoop install git # git
scoop bucket add extras # 添加额外的软件源 (需要 git)
scoop install 7zip # 压缩工具
scoop install gsudo # 提权工具
scoop install neovim # PS
scoop install fzf # PSfzf 依赖
scoop install nvm # node 包管理器
scoop install miniconda3 # python 包管理器
scoop install gh # Github Cli
scoop install rustup # rustup
scoop install mingw # mingw
scoop install openssl-mingw

# Oh My Posh 安装
scoop install https://github.com/JanDeDobbeleer/oh-my-posh/releases/latest/download/oh-my-posh.json
scoop install terminal-icons

3. 软件配置

很多软件在重新下载后还需要手动配置,这里列出一些常用的配置,主要是解决网络问题。

3.0 全局

很多软件会根据环境变量 “HTTP_PROXY” 和 “HTTPS_PROXY” 来自动代理,提前需要设置好环境变量

1
2
[environment]::SetEnvironmentvariable("HTTPS_PROXY", "socks5://127.0.0.1:7890", "User")
[environment]::SetEnvironmentvariable("HTTP_PROXY", "socks5://127.0.0.1:7890", "User")

3.1 scoop

1
scoop config proxy 127.0.0.1:7890 # 设置代理

3.2 npm

1
2
3
npm config set registry http://mirrors.cloud.tencent.com/npm/ # 设置镜像源
npm config set --global proxy=http://127.0.0.1:7890 # 设置 http 代理
npm config set --global https-proxy=http://127.0.0.1:7890 # 设置 https 代理

3.3 pip

1
pip config set global.index-url https://pypi.tuna.tsinghua.edu.cn/simple # 设置 pip 源

3.4 git

1
2
3
4
git config --global user.name "9cats"                       # 设置用户名
git config --global user.email "123337671@qq.com" # 设置邮箱
git config --global http.proxy 'socks5h://127.0.0.1:7890' # 设置 http 代理
git config --global https.proxy 'socks5h://127.0.0.1:7890' # 设置 https 代理

4. 总结

人是会越来越懒的,在使用软件上也一样,对于一款常用的软件,如果一开始的时候就没有对这款软件去探索用法,到后面非必要的话大概率不会再去探索。对于一款使用率不太高的软件,嫌弃麻烦的话,也不会去探索用法,这样就会导致这款软件的使用率越来越低,最后就会被自己淘汰。

用这样的方式来安装软件,减少其安装门槛,同时让自己的电脑更加干净轻量。这样的方式也可以让自己对软件管理有更深的了解,不只是把电脑环境作为工具,而是生活环境的一部分。