Skip to content

windows 系统工作环境

说明

工欲善其事,必先利其器。

ℹ️ 说明

  • ✅:免费|推荐
  • ❎:收费|了解|科学

🍀 准备工作

  • 🗂️ 创建文件夹:DevelopmentApplicationSystemApplication
bash
$ md D:\DevelopmentApplication
$ md D:\SystemApplication
bash
# 第一步:设置安装目录
$ $env:SCOOP='D:\DevelopmentApplication\Scoop'
$ [Environment]::SetEnvironmentVariable('SCOOP', $env:SCOOP, 'User')

# 第二步:开启代理,在 powershell 中安装
$ Set-ExecutionPolicy -ExecutionPolicy RemoteSigned -Scope CurrentUser
$ iex "& {$(irm get.scoop.sh)} -RunAsAdmin"

$ scoop import scoop_backup.json
scoop_backup.json
json
{
  "buckets": [
    {
      "Name": "main",
      "Source": "https://github.com/ScoopInstaller/Main",
      "Updated": "2025-05-17T20:56:48+08:00",
      "Manifests": 1385
    },
    {
      "Name": "extras",
      "Source": "https://github.com/ScoopInstaller/Extras",
      "Updated": "2025-05-17T20:30:47+08:00",
      "Manifests": 2165
    },
    {
      "Name": "nerd-fonts",
      "Source": "https://github.com/matthewjberger/scoop-nerd-fonts",
      "Updated": "2025-05-15T16:32:36+08:00",
      "Manifests": 367
    }
  ],
  "apps": [
    {
      "Version": "24.09",
      "Updated": "2025-04-29T21:36:02.5012826+08:00",
      "Source": "main",
      "Name": "7zip",
      "Info": ""
    },
    {
      "Version": "36.0.0",
      "Updated": "2025-05-14T21:14:23.8308161+08:00",
      "Source": "main",
      "Name": "adb",
      "Info": ""
    },
    {
      "Version": "1.7.16",
      "Updated": "2025-05-08T22:36:26.6907716+08:00",
      "Source": "main",
      "Name": "clink",
      "Info": "Held package"
    },
    {
      "Version": "3.14.1",
      "Updated": "2025-04-29T21:36:07.9938812+08:00",
      "Source": "main",
      "Name": "dark",
      "Info": ""
    },
    {
      "Version": "3.4.0",
      "Updated": "2025-05-06T21:10:07.7615689+08:00",
      "Source": "nerd-fonts",
      "Name": "FiraCode-NF",
      "Info": ""
    },
    {
      "Version": "3.4.0",
      "Updated": "2025-05-06T21:14:33.1318257+08:00",
      "Source": "nerd-fonts",
      "Name": "FiraCode-NF-Mono",
      "Info": ""
    },
    {
      "Version": "1.38.1",
      "Updated": "2025-04-29T21:36:09.8097051+08:00",
      "Source": "main",
      "Name": "fnm",
      "Info": ""
    },
    {
      "Version": "0.62.0",
      "Updated": "2025-05-14T21:14:32.8356849+08:00",
      "Source": "main",
      "Name": "fzf",
      "Info": ""
    },
    {
      "Version": "2.72.0",
      "Updated": "2025-05-14T21:14:40.0368427+08:00",
      "Source": "main",
      "Name": "gh",
      "Info": ""
    },
    {
      "Version": "2.49.0",
      "Updated": "2025-05-06T21:48:24.7346544+08:00",
      "Source": "main",
      "Name": "git",
      "Info": ""
    },
    {
      "Version": "136.0.7103.114",
      "Updated": "2025-05-17T22:28:42.7038594+08:00",
      "Source": "extras",
      "Name": "googlechrome",
      "Info": ""
    },
    {
      "Version": "1.18.0",
      "Updated": "2025-04-29T21:36:19.9556476+08:00",
      "Source": "main",
      "Name": "gping",
      "Info": ""
    },
    {
      "Version": "2.6.0",
      "Updated": "2025-04-29T21:36:24.7728813+08:00",
      "Source": "main",
      "Name": "gsudo",
      "Info": ""
    },
    {
      "Version": "3.4.1",
      "Updated": "2024-12-24T22:19:06.4328822+08:00",
      "Source": "extras",
      "Name": "hyper",
      "Info": ""
    },
    {
      "Version": "2.64.4",
      "Updated": "2025-05-14T21:15:26.707455+08:00",
      "Source": "main",
      "Name": "innounp",
      "Info": ""
    },
    {
      "Version": "1.0.6",
      "Updated": "2024-05-28T21:31:18.4792984+08:00",
      "Source": "extras",
      "Name": "keyviz",
      "Info": ""
    },
    {
      "Version": "1.511",
      "Updated": "2025-05-06T20:58:44.7306861+08:00",
      "Source": "nerd-fonts",
      "Name": "LXGWWenKaiMono",
      "Info": ""
    },
    {
      "Version": "1.7.3",
      "Updated": "2025-04-29T21:35:25.6158778+08:00",
      "Source": "extras",
      "Name": "mihomo-party",
      "Info": ""
    },
    {
      "Version": "1.27.5",
      "Updated": "2025-04-29T21:36:29.7146474+08:00",
      "Source": "main",
      "Name": "nginx",
      "Info": ""
    },
    {
      "Version": "3.22.1",
      "Updated": "2025-04-19T18:41:46.4478529+08:00",
      "Source": "main",
      "Name": "ngrok",
      "Info": ""
    },
    {
      "Version": "1.8.10",
      "Updated": "2025-04-29T22:06:54.5346596+08:00",
      "Source": "extras",
      "Name": "obsidian",
      "Info": ""
    },
    {
      "Version": "2.24.0",
      "Updated": "2025-04-29T21:36:32.2790938+08:00",
      "Source": "extras",
      "Name": "onefetch",
      "Info": ""
    },
    {
      "Version": "250514",
      "Updated": "2025-05-14T21:16:17.3761727+08:00",
      "Source": "extras",
      "Name": "potplayer",
      "Info": ""
    },
    {
      "Version": "0.91.0",
      "Updated": "2025-05-17T22:34:18.6044552+08:00",
      "Source": "extras",
      "Name": "powertoys",
      "Info": ""
    },
    {
      "Version": "3.1.1",
      "Updated": "2025-05-08T21:32:51.1118093+08:00",
      "Source": "main",
      "Name": "pyenv",
      "Info": ""
    },
    {
      "Version": "1.23.0",
      "Updated": "2025-04-29T21:38:51.8768135+08:00",
      "Source": "main",
      "Name": "starship",
      "Info": ""
    },
    {
      "Version": "4.2.0.6119",
      "Updated": "2024-12-24T22:23:16.0817062+08:00",
      "Source": "extras",
      "Name": "switchhosts",
      "Info": ""
    },
    {
      "Version": "1.11.1",
      "Updated": "2025-05-09T21:27:50.7685627+08:00",
      "Source": "main",
      "Name": "tlrc",
      "Info": ""
    },
    {
      "Version": "0.7.5",
      "Updated": "2025-05-17T22:34:35.4970895+08:00",
      "Source": "main",
      "Name": "uv",
      "Info": ""
    },
    {
      "Version": "1.100.2",
      "Updated": "2025-05-17T22:36:08.7225016+08:00",
      "Source": "extras",
      "Name": "vscode",
      "Info": ""
    },
    {
      "Version": "2025.1.1-251.25410.117",
      "Updated": "2025-05-14T21:25:01.9557513+08:00",
      "Source": "extras",
      "Name": "webstorm",
      "Info": ""
    },
    {
      "Version": "4.0.5.13",
      "Updated": "2025-05-17T22:37:53.234378+08:00",
      "Source": "extras",
      "Name": "wechat",
      "Info": ""
    },
    {
      "Version": "0.9.7",
      "Updated": "2025-04-29T21:43:54.932705+08:00",
      "Source": "main",
      "Name": "zoxide",
      "Info": ""
    }
  ]
}
Scoop 常用命令
bash
$ scoop config                     # 查看 Scoop 的配置
$ scoop help                       # 列出所有可用命令
$ scoop search [关键词]             # 在可用的 Bucket 中搜索应用程
$ scoop list                       # 列出所有已安装的软件
$ scoop info [软件名]               # 显示软件包信息
$ scoop home [软件名]               # 打开软件包主页
$ scoop install [软件名]            # 安装软件
$ scoop install -g [软件名]         # 全局安装(管理员权限)
$ scoop uninstall [软件名]          # 卸载软件

$ scoop update                     # 更新 Scoop 自身
$ scoop update *                   # 更新所有应用
$ scoop update [软件名]             # 更新指定应用
$ scoop status                     # 检查可更新的应用
$ scoop hold [软件名]               # 禁止更新指定应用
$ scoop unhold [软件名]             # 解除禁止更新指定应用

$ scoop cache show                 # 显示缓存
$ scoop cache rm [软件名]           # 删除指定应用缓存
$ scoop cleanup [软件名]            # 清理旧版本

# Bucket 本质上是一个 应用程序清单的仓库,它负责存储和管理应用程序的清单,扩展 Scoop 的应用程序范围,简化软件的安装和更新过程。
$ scoop bucket list                # 列出已添加的所有 Bucke
$ scoop bucket update              # 更新所有已添加的 Bucket
$ scoop bucket known               # 列出所有官方认可的 Bucket
$ scoop bucket add [name]          # 添加 Bucket
$ scoop bucket rm [name]           # 删除 Bucket

# 导出已安装 Scoop 应用
$ scoop export > scoop_backup.json
# 从备份文件恢复所有应用
$ scoop import scoop_backup.json

$ scoop alias list
$ scoop alias add [名称] [命令]
# scoop alias add ls 'scoop list'
$ scoop alias rm [名称]
$ scoop alias show [名称]
常用工具下载
bash
$ scoop install git
$ scoop install winrar
$ scoop install mihomo-party
$ scoop install googlechrome
$ scoop install vscode
$ scoop install hyper
$ scoop install starship
$ scoop install clink
$ scoop install switchhosts
$ scoop install obsidian       # 写作应用程序
$ scoop install fnm
$ scoop install gsudo
$ scoop install gping
$ scoop install fzf
$ scoop install zoxide
$ scoop install nginx
$ scoop install ngrok          # 反向代理,内网穿透
$ scoop install tlrc           # 控制台命令速查表 tldr-pages
$ scoop install wechat
$ scoop install webstorm
$ scoop install potplayer      # 万能播放器
$ scoop install keyviz         # 开源按键可视化工具
$ scoop install powertoys      # 自定义 Windows 的实用工具
$ scoop install onefetch
$ scoop install uv             # Python 包和项目管理工具
$ scoop install pyenv
$ scoop install adb
$ scoop install bun
$ scoop install gh
$ scoop install tabby          # 本地 shell、串行、SSH 和 Telnet 连接终端
$ scoop install syncthing

# 安装字体
$ scoop bucket add nerd-fonts

$ scoop install LXGWWenKaiMono
$ scoop install FiraCode-NF
$ scoop install FiraCode-NF-Mono
$ scoop install Monaspace-NF
$ scoop install Monaspace-NF-Mono
$ scoop install Maple-Mono-NF-CN

✍🏻 终端配置

bash
$ md $HOME/.zsh/plugins
$ touch $HISTFILE # 安装成功才能使用

$ git clone https://github.com/zdharma-continuum/fast-syntax-highlighting.git $HOME\.zsh\plugins\fast-syntax-highlighting
$ git clone https://github.com/zsh-users/zsh-autosuggestions.git $HOME\.zsh\plugins\zsh-autosuggestions
$ git clone https://github.com/zsh-users/zsh-completions.git $HOME\.zsh\plugins\zsh-completions
.bashrc 配置文件
bash
if [ -t 1 ]; then
	exec zsh
fi
.zshrc 配置文件
bash
# ~/.zshrc
export ZSH=$HOME/.zsh
export ZSH_COMPDUMP=$ZSH/cache/.zcompdump-$HOST
export HISTFILE=$ZSH/.zsh_history
export HISTSIZE=5000
export SAVEHIST=5000
setopt appendhistory
setopt incappendhistory        # 实时写入,避免丢失
unsetopt sharehistory          # 禁用共享,防止竞争
setopt extended_history        # 记录时间戳
setopt hist_ignore_all_dups    # 完全去重
setopt hist_save_no_dups       # 文件去重
setopt hist_find_no_dups       # 搜索去重
setopt hist_expire_dups_first  # 优先删除重复项
setopt hist_ignore_space       # 忽略以空格开头的命令
setopt hist_reduce_blanks      # 去除多余空格
setopt hist_ignore_dups        # 忽略连续重复命令
setopt hist_verify             # 执行历史命令前先显示
# zsh plugins
source $ZSH/plugins/fast-syntax-highlighting/fast-syntax-highlighting.plugin.zsh
source $ZSH/plugins/zsh-autosuggestions/zsh-autosuggestions.zsh
fpath=($ZSH/plugins/zsh-completions/src $fpath)
ZSH_AUTOSUGGEST_STRATEGY=(history completion)
ZSH_AUTOSUGGEST_BUFFER_MAX_SIZE=20
# plugins end

# fnm
eval "$(fnm env --use-on-cd)"
# fnm end

# fzf
source <(fzf --zsh)
# fzf end

# zoxide
eval "$(zoxide init zsh --cmd cd)"
function cdl() {
    local dir
    dir="$(zoxide query -l | fzf --reverse --height 40% \
        --preview 'ls -l {}' \
        --preview-window=right:60%)" && cd "${dir}"
}
function cdd() {
    local dir
    dir="$(find . -type d 2>/dev/null | fzf --reverse --height 40% \
        --preview 'ls -l {}' \
        --preview-window=right:60%)" && cd "${dir}"
}
# zoxide end

# starship
eval "$(starship init zsh)"
export STARSHIP_CONFIG=$HOME/.config/starship/starship.toml
function set_win_title(){
    echo -ne "\033]0; $(basename "$USER") \007"
}
starship_precmd_user_func="set_win_title"
precmd_functions+=(set_win_title)
# starship end

# uv python 版本管理工具
autoload -Uz compinit && compinit
eval "$(uv generate-shell-completion zsh)"
eval "$(uvx --generate-shell-completion zsh)"
# uv end

# alias
alias ping="gping"
alias of="onefetch"
alias nio="ni --prefer-offline"
alias s="nr start"
alias d="nr dev"
alias b="nr build"
alias cls="clear"
alias gp='git push'
alias gl='git pull'
alias grt='cd "$(git rev-parse --show-toplevel)"'
alias gc='git branch | fzf | xargs git checkout' # 搜索 git 分支并切换
alias t='tldr' # tldr
# alias end

# 添加清理历史记录的函数
function history_clean() {
    # 创建临时文件
    local tmp=$(mktemp)

    # Windows 上没有 tail -r,使用 awk 逆序读取
    awk '
    {
        # 保存所有行
        lines[NR] = $0;
    }
    END {
        # 反向处理每一行
        for (i = NR; i >= 1; i--) {
            line = lines[i];
            if (index(line, ";") > 0) {
                # 命令部分是分号后面的内容
                cmd = substr(line, index(line, ";") + 1);
                if (!seen[cmd]++) {
                    # 第一次遇到这个命令(因为是反向处理的,所以是最新的)
                    result[++count] = line;
                }
            } else {
                # 处理没有分号的行(可能是没有时间戳的记录)
                if (!seen[line]++) {
                    result[++count] = line;
                }
            }
        }

        # 恢复原来的顺序(再次反转)
        for (i = count; i > 0; i--) {
            print result[i];
        }
    }' $HISTFILE > $tmp

    # 确保处理成功后再替换原文件
    if [ -s "$tmp" ]; then
        cp $HISTFILE "$HISTFILE.bak"  # 创建备份
        mv $tmp $HISTFILE
        echo "历史记录已去重,保留了最新的命令记录"
    else
        echo "处理出错,历史记录未修改"
        rm $tmp
    fi
}
git-extras 安装
bash
$ git clone https://github.com/tj/git-extras.git
$ cd git-extras
$ git checkout $(git describe --tags $(git rev-list --tags --max-count=1))
$ ./install.cmd 'D:\DevelopmentApplication\Scoop\apps\git\current'
$ git extras --help
  • ✅️ Hyper - 跨平台的终端软件
    • awesome-hyper
    • 配置文件位置:~\AppData\Roaming\Hyper\.hyper.js
    • fontFamily: 'FiraCode Nerd Font, Input Mono, monospace'
bash
$ hyper install hyper-dracula
$ hyper install hyperborder
$ hyper install hyperpower
bash
$ clink info

# 下载插件
$ git clone https://github.com/vladimir-kotikov/clink-completions D:\\DevelopmentApplication\\Scoop\\apps\\clink\\current\\scripts\\clink-completions
$ git clone https://github.com/chrisant996/clink-gizmos D:\\DevelopmentApplication\\Scoop\\apps\\clink\\current\\scripts\\clink-gizmos

$ clink installscripts D:\\DevelopmentApplication\\Scoop\\apps\\clink\\current\\scripts
$ clink installscripts D:\\DevelopmentApplication\\Scoop\\apps\\clink\\current\\scripts\\clink-completions
$ clink installscripts D:\\DevelopmentApplication\\Scoop\\apps\\clink\\current\\scripts\\clink-gizmos

# 使用方法
$ clink autorun install    # 启用自动运行
$ clink autorun uninstall  # 禁用自动运行
$ clink inject             # 临时运行

$ scoop hold clink         # 禁止更新
  • Starship - 轻量、迅速、客制化的高颜值终端
bash
$ cd .config && mkdir starship && cd starship && type null>starship.toml

# powershell 7
Invoke-Expression (&starship init powershell)
$ENV:STARSHIP_CONFIG = "$HOME\\.config\\starship\\starship.toml"
# end

# powershell 5
Invoke-Expression (& 'D:\DevelopmentApplication\Scoop\apps\starship\current\starship.exe' init powershell)
$ENV:STARSHIP_CONFIG = "$HOME\\.config\\starship\\starship.toml"
# end

# cmd 在 clink\current\scripts 文件中添加 starship.lua
load(io.popen('starship init cmd'):read("*a"))()
os.setenv('STARSHIP_CONFIG', 'C:\\Users\\<username>\\.config\\starship\\starship.toml')
# end
starship.toml 配置文件
bash
command_timeout = 10000

# 在提示符之间插入空行
add_newline = true

# 将提示符中的 '❯' 替换为 '➜'
[character]
success_symbol = '[➜](bold green)'

# 禁用 'package' 组件,将其隐藏
[package]
disabled = true

[localip]
ssh_only = false
format = '[$localipv4](bold green) '
disabled = true

[cmd_duration]
min_time = 500
format = 'underwent [$duration](bold yellow)'
disabled = true

💻️ 开发环境

bash
# 设置本地默认分支 main
$ git config --global init.defaultBranch main

# 设置文件大小写敏感
$ git config --global core.ignorecase false

# 忽略目录安全限制
$ git config --global --add safe.directory "*"

# 管理员身份运行 PowerShell
$ get-ExecutionPolicy
$ set-ExecutionPolicy RemoteSigned

$ $PROFILE                                    # powershell 配置文件地址
$ code $PROFILE                               # 直接打开配置文件
$ $psversiontable                             # powershell 版本
  • fnm - 快速简单的 Node 版本管理器
bash
# fnm 支持多项目单独切换版本
$ echo 'eval "$(fnm env --use-on-cd)"' >> ~/.zshrc
$ source ~/.zshrc

# powershell 7 & powershell 5 需配置
# fnm
fnm env --use-on-cd | Out-String | Invoke-Expression
# fnm end

# cmd 在目标路径后追加
/k %USERPROFILE%\bashrc.cmd
# 在 ~ 目录下创建 bashrc.cmd,内容如下:
@echo off
FOR /f "tokens=*" %%z IN ('fnm env --use-on-cd') DO CALL %%z
# end

$ fnm ls
$ fnm ls-remote
$ fnm ls-remote | grep v20
$ fnm install --lts
$ fnm install --latest
$ fnm install 16.14.2
$ fnm install 14.16.0
$ fnm default X
$ fnm use X

# 项目写入 node 版本
$ node --version > .node-version
  • ✅ 自定义 npm 全局包安装位置
bash
$ mkdir .npm_global
$ npm config set prefix ~/.npm_global

# 设置系统环境变量
C:\Users\wwlight\.npm_global
bash
$ npm i -g nrm        # npm 镜像管理器
$ npm i -g pnpm
$ npm i -g yarn
bash
# 全局安装 ni 及配置
$ npm i -g @antfu/ni

#  powershell 7
Remove-Alias -Name ni -Force
# end

# powershell 5
if (-not (Test-Path $profile)) {
  New-Item -ItemType File -Path (Split-Path $profile) -Force -Name (Split-Path $profile -Leaf)
}
Remove-Item Alias:ni -Force -ErrorAction Ignore
# end

💻️ 其它工具

  • 微信键盘
  • IDM - 是一款优秀下载工具
  • LocalSend - 免费、开源、跨平台,将文件分享到附近的设备
  • FSCapture - 强大、轻便但功能齐全的屏幕捕捉和屏幕录像工具(网上随便搜索注册码)
  • PixPin - 功能强大使用简单的截图/贴图工具
  • 金山毒霸垃圾清理独立版 - 短小精悍垃圾清理工具
  • PicGo - 图片上传 - 管理新体验
  • Watt Toolkit - 开源跨平台的多功能 Steam 工具箱
  • 护眼宝

♻️ 资源平台