|
|
"性能选项-视觉效果"对系统流畅性影响很大,是系统优化必做项目。
手工在界面设置"性能选项-视觉效果",点击确定或者应用后会立即生效,其结果存放在注册表中。
修改对应的注册表后,重启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中
|
|