打开管理员终端,运行以下脚本:
# 必须用管理员权限运行
if (-not ([Security.Principal.WindowsPrincipal][Security.Principal.WindowsIdentity]::GetCurrent()).IsInRole([Security.Principal.WindowsBuiltInRole]::Administrator)) {
Start-Process powershell.exe "-NoProfile -ExecutionPolicy Bypass -File `"$PSCommandPath`"" -Verb RunAs
exit
}
# 设置执行策略(仅首次运行需要)
Set-ExecutionPolicy RemoteSigned -Scope Process -Force
# 定义全量旧→新字体映射表(覆盖GB2312、GBK、XP时代旧名称)
$fontMappings = @{
# 中文旧字体
"楷体_GB2312" = "KaiTi" # 旧楷体 → 新楷体
"仿宋_GB2312" = "FangSong" # 旧仿宋 → 新仿宋
"宋体" = "SimSun" # 旧宋体 → 新宋体
"黑体_GB2312" = "SimHei" # 旧黑体 → 新黑体
"方正小标宋_GBK" = "FZXiaoBiaoSong-B05" # 特殊公文字体
"华文楷体" = "KaiTi" # 第三方字体兼容
# 英文旧字体映射
"Arial Narrow" = "Arial"
"Times New Roman Baltic" = "Times New Roman"
# 系统遗留字体
"MS UI Gothic" = "Yu Gothic UI" # 日语字体更新
"MS Mincho" = "Yu Mincho"
# 扩展修复(来自用户常见问题)
"幼圆" = "YouYuan" # 旧版幼圆字体
"隶书" = "LiSu"
"华文新魏" = "STXinwei"
}
# 注册表路径
$regPath = "HKLM:\SOFTWARE\Microsoft\Windows NT\CurrentVersion\FontSubstitutes"
# 批量修复(带进度显示)
Write-Host "正在扫描并修复旧字体映射..." -ForegroundColor Cyan
$total = $fontMappings.Count
$current = 0
foreach ($key in $fontMappings.Keys) {
$current++
$percent = [math]::Round(($current/$total)*100)
$value = $fontMappings[$key]
# 写入注册表
try {
Set-ItemProperty -Path $regPath -Name $key -Value $value -ErrorAction Stop -Force
Write-Host "[$percent%] 已修复: $key → $value" -ForegroundColor Green
}
catch {
Write-Host "[!] 修复失败: $key (可能权限不足或键值被锁定)" -ForegroundColor Red
}
}
# 完成提示
Write-Host "`n已完成所有旧字体映射修复!" -ForegroundColor Yellow
Write-Host "强烈建议重启电脑使更改生效(未重启前Word可能仍使用缓存)`n" -ForegroundColor Magenta
# 可选:一键打开注册表路径供验证
$choice = Read-Host "是否要立即打开注册表验证修改?(Y/N)"
if ($choice -eq "Y") {
regedit.exe /m /v "HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows NT\CurrentVersion\FontSubstitutes"
}
Read-Host "按回车键退出"