近期清理了一下 Windows 10,卸载了一些不用的程序。然而在 任务栏设置
> 选择哪些图标在任务栏上
发现很多已卸载程序的选项,强迫症患者怎能容忍这种情况发生,所以开始寻找解决办法。
任务栏通知选项缓存在注册表用户配置中:
HKEY_CURRENT_USER\Software\Classes\Local Settings\Software\Microsoft\Windows\CurrentVersion\TrayNotify
里面有两项:IconStreams
和 PastIconsStream
,它们就是罪魁祸首!因为通知选项缓存以二进制格式存在注册表里,程序卸载的时候也没有办法删除单条记录,只能手动全部删除,不知道微软为什么这么设计。
自己改了一个脚本,复制下来保存到文本文件中,把文件名改为 Reset_Notification_Cache.bat
(注意文件名后缀)。运行前保存关闭所有其它程序,然后双击运行就可以了。(安全软件可能会报警,因为该脚本试图修改注册表,放行通过。)
:: Created by Alvin Hu
@echo off
set regPath=HKCU\Software\Classes\Local Settings\Software\Microsoft\Windows\CurrentVersion\TrayNotify
set regKey1=IconStreams
set regKey2=PastIconsStream
echo.
echo The Explorer process must be temporarily termidated before deleting notification area icons cache.
echo.
echo Please SAVE ALL OPEN WORK before continuing.
echo.
pause
echo.
taskkill /IM explorer.exe /F
echo.
echo The Explorer process hase been termidated.
echo.
FOR /F "tokens=*" %%a in ('Reg Query "%regpath%" /v %regkey1% ^| find /i "%regkey1%"') do goto IconStreams
:IconStreams
reg delete "%regpath%" /f /v "%regkey1%"
echo.
echo Registry key "IconStreams" has been deleted.
echo.
FOR /F "tokens=*" %%a in ('Reg Query "%regpath%" /v %regkey2% ^| find /i "%regkey2%"') do goto PastIconsStream
goto restart
:PastIconsStream
reg delete "%regpath%" /f /v "%regkey2%"
echo.
echo Registry key "PastIconsStream" has been deleted.
echo.
:restart
echo.
echo You will need to restart the PC to finish resetting your notification area icons.
echo.
CHOICE /C:YN /M "Do you want to restart the PC now?"
IF ERRORLEVEL 2 goto no
IF ERRORLEVEL 1 goto yes
:no
echo.
echo Restarting explorer...
echo.
echo Please remember to restart the PC later to finish resetting your notification area icons.
echo.
start explorer.exe
pause
exit /B
:yes
shutdown /r /f /t 00
运行截图:
图片里有错误,那是因为 Windows 10 没有 PastIconsStream
这项。
执行完了重启系统,大功告成!这个世界又恢复干净了!