近期清理了一下 Windows 10,卸載了一些不用的程序炕淮。然而在 任務(wù)欄設(shè)置
> 選擇哪些圖標在任務(wù)欄上
發(fā)現(xiàn)很多已卸載程序的選項,強迫癥患者怎能容忍這種情況發(fā)生滤否,所以開始尋找解決辦法驹饺。
任務(wù)欄通知選項緩存在注冊表用戶配置中:
HKEY_CURRENT_USER\Software\Classes\Local Settings\Software\Microsoft\Windows\CurrentVersion\TrayNotify
里面有兩項:IconStreams
和 PastIconsStream
钳枕,它們就是罪魁禍首!因為通知選項緩存以二進制格式存在注冊表里赏壹,程序卸載的時候也沒有辦法刪除單條記錄鱼炒,只能手動全部刪除,不知道微軟為什么這么設(shè)計蝌借。
自己改了一個腳本田柔,復(fù)制下來保存到文本文件中,把文件名改為 Reset_Notification_Cache.bat
(注意文件名后綴)骨望。運行前保存關(guān)閉所有其它程序硬爆,然后雙擊運行就可以了。(安全軟件可能會報警擎鸠,因為該腳本試圖修改注冊表缀磕,放行通過。)
:: 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
這項袜蚕。
執(zhí)行完了重啟系統(tǒng),大功告成绢涡!這個世界又恢復(fù)干凈了牲剃!