找回密码
 注册
搜索
系统gho:最纯净好用系统下载站投放广告、加入VIP会员,请联系 微信:wuyouceo
查看: 83|回复: 5

[分享] 批处理中设置"性能选项-视觉效果"立即生效

[复制链接]
发表于 1 小时前 | 显示全部楼层 |阅读模式
"性能选项-视觉效果"对系统流畅性影响很大,是系统优化必做项目。

手工在界面设置"性能选项-视觉效果",点击确定或者应用后会立即生效,其结果存放在注册表中。

修改对应的注册表后,重启explorer.exe和dwm.exe都无法让其立即生效,必须重新登录才会生效。

网上说的 执行rundll32 USER32.DLL,UpdatePerUserSystemParameters 可让其立即生效,经测试,结果很玄学,调用n次后,的确可以生效,但n是个随机数,完全没规律,不靠谱,放弃。

扭到AI折腾了半天,用powershell调用API SystemParametersInfo可以设置各种视觉效果立即生效,自用的脚本如下:

::视觉效果,先调API立即生效,再改注册表确保重新登录后生效,对当前用户生效,无需管理员权限
powershell -NoP -C "$spi=Add-Type -Name Win -Namespace NS -PassThru -MemberDefinition '[DllImport(\"user32.dll\")]public static extern bool SystemParametersInfo(uint a,uint b,IntPtr c,uint d);';$ptr=[System.Runtime.InteropServices.Marshal]::AllocHGlobal(8);[System.Runtime.InteropServices.Marshal]::WriteInt32($ptr,0,8);$spi::SystemParametersInfo(0x0048,8,$ptr,0);[System.Runtime.InteropServices.Marshal]::WriteInt32($ptr,4,0);$spi::SystemParametersInfo(0x0049,8,$ptr,0);[System.Runtime.InteropServices.Marshal]::FreeHGlobal($ptr);$spi::SystemParametersInfo(0x1007,0,[IntPtr]::Zero,3);$spi::SystemParametersInfo(0x1017,0,[IntPtr]::Zero,3);$spi::SystemParametersInfo(0x1043,0,[IntPtr]::Zero,3);$spi::SystemParametersInfo(0x1005,0,[IntPtr]::Zero,3);$spi::SystemParametersInfo(0x1003,0,[IntPtr]::Zero,3);$spi::SystemParametersInfo(0x1015,0,[IntPtr]::Zero,3);"

reg add "hkcu\Control Panel\Desktop" /v "UserPreferencesMask" /t REG_BINARY /d "9012038010000000" /f
reg add "hkcu\Control Panel\Desktop\WindowMetrics" /v "MinAnimate" /t REG_SZ /d "0" /f
reg add "hkcu\Software\Microsoft\Windows\CurrentVersion\Explorer\Advanced" /v "TaskbarAnimations" /t REG_DWORD /d "0" /f
reg add "hkcu\Software\Microsoft\Windows\CurrentVersion\Explorer\VisualEffects" /v "VisualFXSetting" /t REG_DWORD /d "3" /f
reg add "hkcu\Software\Microsoft\Windows\DWM" /v "EnableAeroPeek" /t REG_DWORD /d "0" /f

喜欢不同视觉效果的,可参考函数官方文档自行调整
https删://learn.microsoft.com/zh-cn/windows/win32/api/winuser/nf-winuser-systemparametersinfow

另外,这些注册表项目,如果挂载 \users\default\ntuser.dat修改,并不会复制到新用户的HKCU中





点评

喜欢不同视觉效果的,可参考函数官方文档自行调整:https://learn.microsoft.com/zh-cn/windows/win32/api/winuser/nf-winuser-systemparametersinfow  发表于 半小时前
发表于 半小时前 | 显示全部楼层
楼主辛苦了,谢谢
回复

使用道具 举报

发表于 半小时前 | 显示全部楼层
喜欢不同视觉效果的,可参考函数官方文档自行调整:https://learn.microsoft.com/zh-c ... stemparametersinfow
回复

使用道具 举报

发表于 半小时前 | 显示全部楼层
支持折腾
回复

使用道具 举报

发表于 5 分钟前 | 显示全部楼层
感谢分享
回复

使用道具 举报

您需要登录后才可以回帖 登录 | 注册

本版积分规则

小黑屋|手机版|Archiver|捐助支持|无忧启动 ( 闽ICP备05002490号-1|闽公网安备35020302032614号 )

GMT+8, 2026-5-20 17:51

Powered by Discuz! X5.0

© 2001-2026 Discuz! Team.

快速回复 返回顶部 返回列表