Skip to content

Windows系统重装参考指南

系统安装

  1. 下载ISO镜像
  2. 使用Rufus制作启动盘
  3. 进入BIOS,设置启动顺序为U盘启动
  4. 安装系统

下载ISO镜像

(windows10)[https://www.microsoft.com/zh-cn/software-download/windows10]

制作启动盘

Rufus

进入BIOS

通常是F2、Delete、F1、F10或Esc键,具体是哪个键取决于电脑品牌和型号 例如联想:F2 惠普: F10

Windows & Office激活

powershell
irm https://massgrave.dev/get | iex

# 或者使用
irm https://get.activated.win | iex

IDM激活

参考:IDM-Activation-Script

  1. 先从官网下载IDM,直接安装
  2. 运行下面的脚本,根据选项激活即可:
powershell
iex(irm is.gd/idm_reset)

# 或者使用
irm https://raw.githubusercontent.com/lstprjct/IDM-Activation-Script/main/IAS.ps1 | iex

系统优化

净化系统

使用 Win11Debloat 工具:

powershell
# 基础净化
& ([scriptblock]::Create((irm "https://win11debloat.raphi.re/")))

# 静默执行默认选项
& ([scriptblock]::Create((irm "https://win11debloat.raphi.re/"))) -RunDefaults -Silent

Scoop包管理器配置

初始设置

  1. 解除PowerShell执行限制:
powershell
Set-ExecutionPolicy -ExecutionPolicy RemoteSigned -Scope CurrentUser
  1. 下载安装脚本并自定义安装路径:
powershell
# 下载安装脚本
irm get.scoop.sh -outfile 'install.ps1'

# 自定义安装路径
.\install.ps1 -ScoopDir 'C:\Apps\Scoop'

常用软件安装

powershell
# 基础工具
scoop install git
scoop install aria2
scoop bucket add extras

# 常用软件
scoop install listary
scoop install googlechrome
scoop install firefox
scoop install min
scoop install geekuninstaller

# Scoop工具
scoop install scoop-completion
scoop install scoop-search

Scoop常用命令

powershell
# 软件安装
scoop install [app1] [app2] [app3]    # 多软件安装
scoop install [app]@[version]          # 安装指定版本

# 软件管理
scoop list                             # 查看软件列表
scoop info [app]                       # 查看软件信息
scoop bucket search [app]              # 查看软件版本
scoop update [app]                     # 更新软件
scoop update *                         # 更新所有软件
scoop uninstall [app]                  # 卸载软件
scoop uninstall *                      # 卸载所有软件

# 缓存管理
scoop cache rm [app]                   # 清理缓存
scoop cache rm *                       # 清理所有缓存
scoop cleanup [app]                    # 清理不再使用的软件
scoop cleanup *                        # 清理所有不再使用的软件

# 其他操作
scoop status                           # 查看软件状态
scoop reset [app]                      # 重置软件版本
scoop help                             # 查看帮助

版本切换示例

powershell
# 重置/切换版本
scoop reset app_name

# 示例:Python版本切换
scoop reset python27    # 从Python 3.x切换到Python 2.7

# 安装特定版本
scoop install AppName@[version]    # 例如:scoop install python@3.8.0

PowerShell配置

配置文件设置

使用以下命令打开配置文件:

powershell
notepad $PROFILE

基础配置

powershell
# 启用行内自动补全,按右方向键补全
Set-PSReadLineOption -PredictionSource History

# 启用自动补全列表,按F2切换行内补全和补全列表
Set-PSReadLineOption -PredictionSource History -PredictionViewStyle ListView

# 按Tab键显示补全菜单,按方向键切换选项
Set-PSReadlineKeyHandler -Key Tab -Function MenuComplete

# 行内自动补全使用Ctrl+右方向键按单词补全
Set-PSReadLineKeyHandler -Chord "Ctrl+RightArrow" -Function ForwardWord

Oh My Posh主题配置

Oh My Posh

powershell
# 当前使用的主题配置
oh-my-posh init pwsh --config "$env:POSH_THEMES_PATH/M365Princess.omp.json" | Invoke-Expression

# 其他主题选项
# oh-my-posh init pwsh --config "$env:POSH_THEMES_PATH/easy-term.omp.json" | Invoke-Expression
# oh-my-posh init pwsh --config "$env:POSH_THEMES_PATH/gmay.omp.json" | Invoke-Expression

模块引入

powershell
# 引入PSReadLine
Import-Module PSReadLine

# 引入posh-git
Import-Module posh-git

PSReadLine说明

PSReadLine是一个用于增强PowerShell命令行体验的模块,它提供了更好的命令行编辑、历史记录管理和自动补全功能。通过引入此模块,用户可以获得更流畅的输入体验。

posh-git说明

posh-git是一个用于在PowerShell中显示Git状态信息的模块。它会在提示符中显示当前Git仓库的状态,包括分支名称、未提交的更改等。这使得用户在使用Git时能够快速获取相关信息,提高工作效率。

参考资料