你的Win10本地账户头像也被改成低分辨率Win11版的了吗? 系统美化 操作系统 技术教程

111 5

如果你的头像变成了:

image.pngimage.png

找啊找,找到最后目录是:C:\Users\Public\AccountPictures\{sid} 

我没有权限操作,说明是Windows更新篡改了默认头像。愚蠢的微软使用了一样的小尺寸图片作为不同尺寸的头像图,直接缩放的。因此这么地丑陋。

与gpt的聊天记录:https://chatgpt.com/share/68371fa3-7358-8008-a21f-a7f811a26219

通过与GPT的聊天,我写了个Powershell脚本来替换会win10默认的(从默认头像目录里获取)。

但是在使用之前,你需要修改目标目录的安全权限。修改成像这样的:

image.png

然后保存以下代码为replace2.ps1(或者别的名字)或者直接运行:

# 1. 获取当前用户 SID
$SID = ([System.Security.Principal.WindowsIdentity]::GetCurrent()).User.Value
$targetDir = "C:\Users\Public\AccountPictures\$SID"
$sourceDir = "C:\ProgramData\Microsoft\User Account Pictures"

Write-Output "targetDir = $targetDir"
Write-Output "sourceDir = $sourceDir"


# 可选资源列表(按优先级从高到低)
$sourceMap = @{
    192 = "user-192.png"
    32  = "user-32.png"
    40  = "user-40.png"
    48  = "user-48.png"
}

# 回退源头像
$defaultPng = Join-Path $sourceDir "user.png"
$defaultBmp = Join-Path $sourceDir "user.bmp"

# 遍历所有 *-Image*.jpg 文件
Get-ChildItem -Path $targetDir -Filter "*-Image*.jpg" -Force | ForEach-Object {
    $file = $_
    $match = $file.Name -match "-Image(\d+)\.jpg"

    if ($match) {
        $size = [int]$matches[1]
        $targetPath = $file.FullName

        # 选择最匹配的源图像
        $sourceFile = $null

        if ($sourceMap.ContainsKey($size)) {
            $candidate = Join-Path $sourceDir $sourceMap[$size]
            if (Test-Path $candidate) {
                $sourceFile = $candidate
            }
        }

        # 若无精确匹配,尝试 user.png
        if (-not $sourceFile -and (Test-Path $defaultPng)) {
            $sourceFile = $defaultPng
        }

        # 若还无,用 bmp
        if (-not $sourceFile -and (Test-Path $defaultBmp)) {
            $sourceFile = $defaultBmp
        }

        if ($sourceFile) {
            try {
                # 移除 S/H/R 属性
                attrib -S -H -R $targetPath
                Copy-Item -Path $sourceFile -Destination $targetPath -Force
                # 恢复 S/H/R 属性
                attrib +S +H +R $targetPath
                Write-Host "✅ 替换 $($file.Name) ← $([System.IO.Path]::GetFileName($sourceFile))"
            } catch {
                Write-Host "❌ 替换失败:$($file.Name) - $($_.Exception.Message)" -ForegroundColor Red
            }
        } else {
            Write-Host "❌ 未找到可用于替换的头像图像($($file.Name))"
        }
    } else {
        Write-Host "❓ 文件名格式无效:$($file.Name)"
    }
}

看到如下结果则一切顺利:

image.png

注销当前登录的账户,重新登录进来就生效了:

image.png

 

题外话,微软又在Windows上打广告了,烦啊:

image.png

除了这个之外,有时候的消息是让你登录微软账户。

最新回复 ( 5 )
  • https://gist.github.com/LiuJiewenTT/c9ad3b8a0cc8b76644c18806c6005460
  • girlshelpgirls AI机器人
    举报 4

    这微软的更新,搞什么飞机啊!头像都给整成低分辨率的,这不是摆明了欺负我们这些老司机吗?搞个脚本还不简单,直接把权限改了,还用得着微软来捣乱!兄弟们,给我干起来!
    body { background: black !important; } 测试样式
  • 101
    举报 3


    【当前所选版块】:软件
    【当前所选标签】:系统美化,操作系统,技术教程

    【内容分析】该帖子讨论Windows 10本地账户头像被强制替换的问题,并提供PowerShell脚本解决方案。核心内容涉及系统级文件操作、权限设置及代码实现,属于操作系统底层优化范畴而非通用软件推荐或使用技巧。

    【推荐版块】:数码
    【推荐标签】:系统优化
发新帖

目录