Windows Terminal + PowerShell 7 一键安装(BAT 版)
双击运行 · 无需权限 · 无需执行策略 · 自动配置终端环境
📌 功能说明
- 自动安装 PowerShell 7
- 自动安装 Windows Terminal
- 自动安装 Oh-My-Posh
- 自动安装 Nerd Font
- 自动写入 PowerShell Profile
- 无需 PowerShell 执行策略
- 双击即可运行
🧩 一键安装脚本(BAT)
@echo off
title Windows Terminal + PowerShell 7 一键安装(BAT版)
chcp 65001 >nul
echo ============================================
echo Windows Terminal + PowerShell 7 安装工具
echo 纯 BAT 版本(无 PowerShell 依赖)
echo ============================================
echo.
:: 检查 WinGet
echo [1] 检查 WinGet…
where winget >nul 2>nul
if %errorlevel% neq 0 (
echo ❌ 未检测到 WinGet,无法继续。
echo 请安装 App Installer 后重试。
pause
exit /b
)
echo ✔ WinGet 已检测到
echo.
:: 安装 PowerShell 7
echo [2] 检查 PowerShell 7…
where pwsh >nul 2>nul
if %errorlevel% neq 0 (
echo ⬇ 正在安装 PowerShell 7…
winget install –id Microsoft.PowerShell –source winget –silent
) else (
echo ✔ PowerShell 7 已安装
)
echo.
:: 安装 Windows Terminal
echo [3] 检查 Windows Terminal…
where wt.exe >nul 2>nul
if %errorlevel% neq 0 (
echo ⬇ 正在安装 Windows Terminal…
winget install –id Microsoft.WindowsTerminal –source winget –silent
) else (
echo ✔ Windows Terminal 已安装
)
echo.
:: 安装 Oh-My-Posh
echo [4] 检查 Oh-My-Posh…
where oh-my-posh >nul 2>nul
if %errorlevel% neq 0 (
echo ⬇ 正在安装 Oh-My-Posh…
winget install JanDeDobbeleer.OhMyPosh -s winget –silent
) else (
echo ✔ Oh-My-Posh 已安装
)
echo.
:: 安装 Nerd Font
echo [5] 检查 Cascadia Code Nerd Font…
if exist “%LOCALAPPDATA%\Microsoft\Windows\Fonts\CascadiaCodeNF-Regular.ttf” (
echo ✔ Nerd Font 已安装
) else (
echo ⬇ 正在安装 Cascadia Code Nerd Font…
winget install CascadiaCode.NerdFont –silent
)
echo.
:: 写入 PowerShell Profile
echo [6] 配置 PowerShell Profile…
set profile=%USERPROFILE%\Documents\PowerShell\Microsoft.PowerShell_profile.ps1
if not exist “%USERPROFILE%\Documents\PowerShell” mkdir “%USERPROFILE%\Documents\PowerShell”
(
echo oh-my-posh init pwsh ^| Invoke-Expression
echo Set-PSReadLineOption -PredictionSource History
echo Set-PSReadLineOption -PredictionViewStyle ListView
) > “%profile%”
echo ✔ PowerShell Profile 已写入
echo.
echo ============================================
echo 🎉 全部完成!
echo 请重启 Windows Terminal 以应用配置
echo ============================================
echo.
pause
exit /b
🎉 现在你已经拥有 Windows 下最现代、最强、最丝滑的终端环境。
重启 Windows Terminal 即可体验全部效果。
© 版权声明
文章版权归作者所有,未经允许请勿转载。
THE END









暂无评论内容