|
|
提供豆沙绿跟恢复两个bat
恢复白色
@echo off
chcp 936 >nul
title 恢复窗口背景为默认白色
:: 检查管理员权限
>nul 2>&1 "%SYSTEMROOT%\system32\cacls.exe" "%SYSTEMROOT%\system32\config\system"
if '%errorlevel%' NEQ '0' (
echo 请右键此文件,选择"以管理员身份运行"
pause
exit /B
)
echo.
echo [1/3] 恢复注册表默认值...
reg add "HKCU\Control Panel\Colors" /v Window /t REG_SZ /d "255 255 255" /f >nul 2>&1
reg add "HKLM\SOFTWARE\Microsoft\Windows\CurrentVersion\Themes\DefaultColors\Standard" /v Window /t REG_BINARY /d ffffff /f >nul 2>&1
reg add "HKLM\SOFTWARE\Microsoft\Windows\CurrentVersion\Themes\DefaultColors\HighContrast" /v Window /t REG_BINARY /d ffffff /f >nul 2>&1
reg delete "HKCU\Control Panel\Desktop\Colors" /v Window /f >nul 2>&1
echo [2/3] 调用系统API立即生效(无需注销重启)...
powershell -NoProfile -Command "Add-Type -MemberDefinition '[DllImport(\"user32.dll\")]public static extern bool SetSysColors(int c,int[] e,int[] v);[DllImport(\"user32.dll\")]public static extern IntPtr SendMessageW(IntPtr h,uint m,IntPtr w,string l);' -Name S -Namespace W;[W.S]::SetSysColors(1,[int[]]@(5),[int[]]@(16777215));[W.S]::SendMessageW([IntPtr]65535,0x1A,[IntPtr]::Zero,'WindowColors')" >nul 2>&1
echo [3/3] 完成!
echo.
echo 窗口背景已恢复为默认白色。
echo 个别已打开的程序如未变色,关闭重新打开即可。
echo.
pause
豆沙绿
@echo off
chcp 936 >nul
title 开启豆沙绿护眼模式
:: 检查管理员权限
>nul 2>&1 "%SYSTEMROOT%\system32\cacls.exe" "%SYSTEMROOT%\system32\config\system"
if '%errorlevel%' NEQ '0' (
echo 请右键此文件,选择"以管理员身份运行"
pause
exit /B
)
echo.
echo [1/3] 写入注册表(持久化,重启后仍生效)...
reg add "HKCU\Control Panel\Colors" /v Window /t REG_SZ /d "199 237 204" /f >nul 2>&1
reg add "HKLM\SOFTWARE\Microsoft\Windows\CurrentVersion\Themes\DefaultColors\Standard" /v Window /t REG_BINARY /d c7edcc /f >nul 2>&1
reg add "HKLM\SOFTWARE\Microsoft\Windows\CurrentVersion\Themes\DefaultColors\HighContrast" /v Window /t REG_BINARY /d c7edcc /f >nul 2>&1
echo [2/3] 清理旧脚本写入的错误残留...
reg delete "HKCU\Control Panel\Desktop\Colors" /v Window /f >nul 2>&1
echo [3/3] 调用系统API立即生效(无需注销重启)...
powershell -NoProfile -Command "Add-Type -MemberDefinition '[DllImport(\"user32.dll\")]public static extern bool SetSysColors(int c,int[] e,int[] v);[DllImport(\"user32.dll\")]public static extern IntPtr SendMessageW(IntPtr h,uint m,IntPtr w,string l);' -Name S -Namespace W;[W.S]::SetSysColors(1,[int[]]@(5),[int[]]@(13430215));[W.S]::SendMessageW([IntPtr]65535,0x1A,[IntPtr]::Zero,'WindowColors')" >nul 2>&1
echo 完成!
echo.
echo 传统Win32程序(记事本、资源管理器、Word等)已变为豆沙绿。
echo 浏览器网页、UWP应用不受影响。
echo 如需恢复默认白色,请运行"恢复白色.bat"
echo.
pause
|
|