惯性聚合 高效追踪和阅读你感兴趣的博客、新闻、科技资讯
阅读原文 在惯性聚合中打开

推荐订阅源

WordPress大学
WordPress大学
Blog — PlanetScale
Blog — PlanetScale
S
Security @ Cisco Blogs
G
GRAHAM CLULEY
L
LINUX DO - 热门话题
AWS News Blog
AWS News Blog
P
Privacy International News Feed
Cyberwarzone
Cyberwarzone
P
Proofpoint News Feed
腾讯CDC
美团技术团队
宝玉的分享
宝玉的分享
博客园 - 聂微东
小众软件
小众软件
T
Threat Research - Cisco Blogs
L
Lohrmann on Cybersecurity
雷峰网
雷峰网
T
Threatpost
The Hacker News
The Hacker News
P
Palo Alto Networks Blog
L
LangChain Blog
Cisco Talos Blog
Cisco Talos Blog
G
Google Developers Blog
V
Vulnerabilities – Threatpost
NISL@THU
NISL@THU
cs.CL updates on arXiv.org
cs.CL updates on arXiv.org
Engineering at Meta
Engineering at Meta
T
Troy Hunt's Blog
F
Full Disclosure
博客园_首页
The Last Watchdog
The Last Watchdog
S
Secure Thoughts
H
Heimdal Security Blog
Hacker News: Ask HN
Hacker News: Ask HN
C
Check Point Blog
Hacker News - Newest:
Hacker News - Newest: "LLM"
PCI Perspectives
PCI Perspectives
Microsoft Security Blog
Microsoft Security Blog
S
Security Affairs
量子位
Cloudbric
Cloudbric
H
Hacker News: Front Page
cs.CV updates on arXiv.org
cs.CV updates on arXiv.org
L
LINUX DO - 最新话题
IT之家
IT之家
D
Darknet – Hacking Tools, Hacker News & Cyber Security
Exploit-DB.com RSS Feed
Exploit-DB.com RSS Feed
Spread Privacy
Spread Privacy
Forbes - Security
Forbes - Security
Security Archives - TechRepublic
Security Archives - TechRepublic

博客园 - 陈大欠

andrej karpathy skills 从 Harness Engineering 到 superpowers 从 Harness Engineering 到 OpenSpec 从 Harness Engineering 到 Trellis Harness Engineering copilot-api:让 ClaudeCode 接入 Github Copilot Claude Code Hooks 配置说明 Scoop Claude-LED MagicCenterHub 玩转 Visual Studio 外部工具 WCF API 语义搜索工具 Step Builder:让对象构建有顺序、有边界、有校验 基于 Attribute 的 AOP 字段校验 浅析 .NET 响应式编程 IObservable与ReactiveX Cron表达式简明教程 正则表达式拾遗 快速批量升级 NugetPackage 版本 C# IEquatable和IEqualityComparer 最佳实践 使用XDT提高开发效率 如何保证XML正确性 分析 Dump 入门简明教程 Git commit emoji 对照表 ELK Stack 笔记 HTML5/CSS3(PrefixFree.js) 3D文字特效 Jquery实现图片上下一张 js css 构建滚动边框 使用jquery构建Metro style 返回顶部 使用js实现移动设备访问跳转到指定目录 从一幅图中了解开源世界 Jquery ajax 学习笔记 工欲善其事必先利其器系列之:在VS里面折叠js代码
Windows Terminal & PowerShell
陈大欠 · 2026-07-18 · via 博客园 - 陈大欠

PowerShell 7 美化

在Windows开发环境中,PowerShell 7作为新一代命令行工具,凭借其强大的功能和跨平台支持,已成为开发者的首选。本文将手把手教你安装PowerShell 7,并通过自定义profile文件应用美化配置,让你的终端界面焕然一新,同时提升操作效率。

推荐使用最新的 PowerShell 7 可以跨平台,基于.NET8。系统自带的是 PowerShell 5

PowerShell 牛逼之处在于使用.NET下的技术栈,能直接操作 BCL 等,相比传统的 Shell 他管道传递的是对象

另外推荐使用 windows terminal

安装PowerShell 7

下载安装包
访问PowerShell官方install-powershell-on-windows?view=powershell-7.6)
打开新的PowerShell 7终端窗口,执行命令:

$PSVersionTable.PSVersion

Major  Minor  Patch  PreReleaseLabel BuildLabel
-----  -----  -----  --------------- ----------
7      6      0

若显示版本号(如7.x.x),说明安装成功。

快捷键

虽然 WinTerminal 没有 tmux 分屏好用,但是还是支持了很多操作

ALT + SHIFT + ‘+’ 左右分屏

ALT + SHIFT + ’-‘ 上下分屏

ALT + 箭头(↑ ↓ ← →)不同分屏之间切换

ALT + SHIFT + 箭头(↑ ↓ ← →)调整分屏大小

CTRL + SHIFT + w 关闭一个分屏

WIN + TILDA(~)显示隐藏 quake 窗口

配置美化:应用自定义profile文件

准备工作:安装必要模块

# 安装oh-my-posh(美化主题必备)
Install-Module oh-my-posh -Scope CurrentUser -Force

# 安装posh-git(Git集成增强)
Install-Module posh-git -Scope CurrentUser -Force

# 安装Terminal-Icons(文件图标支持)
Install-Module Terminal-Icons -Scope CurrentUser -Force

创建或编辑PowerShell Profile文件

PowerShell的profile文件用于保存个性化配置。执行以下命令打开或创建profile:

notepad $PROFILE

若提示文件不存在,会自动创建。profile文件默认路径为:

完整配置

$PROFILE

# ===== Fast Profile =====

# 基础编辑体验
Set-PSReadLineOption -PredictionViewStyle ListView -BellStyle None -EditMode Windows
Set-PSReadLineKeyHandler -Key 'Ctrl+z' -Function Undo
Set-PSReadLineKeyHandler -Key Tab -Function MenuComplete

# 安全导入函数
function Import-ModuleSafe {
    param([string]$ModuleName)
    if (Get-Module -ListAvailable -Name $ModuleName -ErrorAction SilentlyContinue) {
        Import-Module $ModuleName -ErrorAction SilentlyContinue
    }
}

Import-ModuleSafe 'CompletionPredictor'
Import-ModuleSafe 'PSCompletions'   # 先注释,按需再开
if (Get-Command carapace -ErrorAction SilentlyContinue) {
     carapace _carapace | Out-String | Invoke-Expression
 }

# 5) 主题:直接固定路径,避免每次 scoop prefix
$omp = Get-Command oh-my-posh -ErrorAction SilentlyContinue
$themeFile = "$env:USERPROFILE\scoop\apps\oh-my-posh\current\themes\jtracey93.omp.json"
if ($omp) {
    if (Test-Path $themeFile) {
        & $omp.Source init pwsh --config $themeFile | Invoke-Expression
    } else {
        & $omp.Source init pwsh --config "builtin:agnoster" | Invoke-Expression
    }
}

Import-ModuleSafe 'posh-git'
Import-ModuleSafe 'Terminal-Icons'

Setting.json

字体推荐使用 MesloLGS NF

{
    "$help": "https://aka.ms/terminal-documentation",
    "$schema": "https://aka.ms/terminal-profiles-schema",
    "actions": [],
    "copyFormatting": "none",
    "copyOnSelect": false,
    "defaultProfile": "{574e775e-4f2a-5b96-ac1e-a2962a402336}",
    "keybindings":
    [
        {
            "id": "Terminal.CopyToClipboard",
            "keys": "ctrl+c"
        },
        {
            "id": "Terminal.PasteFromClipboard",
            "keys": "ctrl+v"
        },
        {
            "id": "Terminal.FindText",
            "keys": "ctrl+shift+f"
        },
        {
            "id": "Terminal.DuplicatePaneAuto",
            "keys": "alt+shift+d"
        }
    ],
    "newTabMenu":
    [
        {
            "type": "remainingProfiles"
        }
    ],
    "profiles":
    {
        "defaults":
        {
            "backgroundImage": "D:\\OneDrive\\ApplicationData\\Themes\\2560x1440.jpg",
            "backgroundImageOpacity": 0.3,
            "font":
            {
                "face": "MesloLGS NF"
            }
        },
        "list":
        [
            {
                "commandline": "C:\\Program Files\\PowerShell\\7\\pwsh.exe -NoExit -Command \"cd 'D:\\Source\\Beisen\\Beisen.UserFramework'; claude --verbose\"",
                "guid": "{a0a0a0a0-a0a0-4a0a-8a0a-a0a0a0a0a0a0}",
                "icon": "D:\\OneDrive\\ApplicationData\\icon\\Claude.png",
                "name": "Claude Beisen.AppFSystem",
                "suppressApplicationTitle": true
            },
            {
                "backgroundImage": "D:\\OneDrive\\ApplicationData\\Themes\\2560x1440.jpg",
                "backgroundImageOpacity": 0.4,
                "commandline": "C:\\Program Files\\PowerShell\\7\\pwsh.exe",
                "guid": "{574e775e-4f2a-5b96-ac1e-a2962a402336}",
                "hidden": false,
                "name": "PowerShell7",
                "source": "Windows.Terminal.PowershellCore",
                "suppressApplicationTitle": true
            },
            {
                "commandline": "%USERPROFILE%\\scoop\\apps\\git\\current\\usr\\bin\\bash.exe --login -i",
                "guid": "{d15b228a-05d7-50d1-8472-f60aaba86efc}",
                "icon": "%USERPROFILE%\\scoop\\apps\\git\\current\\usr\\share\\git\\git-for-windows.ico",
                "name": "Git Bash",
                "startingDirectory": "%USERPROFILE%"
            },
            {
                "commandline": "%SystemRoot%\\System32\\cmd.exe",
                "guid": "{0caa0dad-35be-5f56-a8ff-afceeeaa6101}",
                "hidden": false,
                "name": "\u547d\u4ee4\u63d0\u793a\u7b26"
            }
      
        ]
    },
    "schemes": [],
    "themes": []
}

参考资料