Internet Explorer / Edge (Legacy) 的 Cookie 與 Temporary Internet Files 分散於各使用者設定檔,手動逐一清除極度繁瑣。本文提供批次檔腳本,一次掃描 `Documents and Settings` (Win7/XP) 或 `Users` (Win8/10/11) 下所有帳號,自動刪除 Cookie 與快取資料夾內容。
@echo off
color 0a
cls
echo 正在清理所有使用者 Cookie 與暫存網頁檔...
rem 建立使用者清單
dir "%SystemDrive%\Users" /ad /b > "%SystemDrive%\UserList.txt" 2>nul
if errorlevel 1 dir "%SystemDrive%\Documents and Settings" /ad /b > "%SystemDrive%\UserList.txt"
for /f "delims=" %%u in ('type "%SystemDrive%\UserList.txt"') do (
echo 正在處理使用者: %%u
rem Cookie 資料夾 (Vista/7/8/10/11)
if exist "%SystemDrive%\Users\%%u\AppData\Roaming\Microsoft\Windows\Cookies" (
del /f /s /q "%SystemDrive%\Users\%%u\AppData\Roaming\Microsoft\Windows\Cookies\*.*"
)
rem Temporary Internet Files (Vista/7/8/10/11)
if exist "%SystemDrive%\Users\%%u\AppData\Local\Microsoft\Windows\INetCache" (
del /f /s /q "%SystemDrive%\Users\%%u\AppData\Local\Microsoft\Windows\INetCache\*.*"
)
rem XP/舊版相容路徑
if exist "%SystemDrive%\Documents and Settings\%%u\Cookies" (
del /f /s /q "%SystemDrive%\Documents and Settings\%%u\Cookies\*.*"
)
if exist "%SystemDrive%\Documents and Settings\%%u\Local Settings\Temporary Internet Files" (
del /f /s /q "%SystemDrive%\Documents and Settings\%%u\Local Settings\Temporary Internet Files\*.*"
)
)
del /f /q "%SystemDrive%\UserList.txt"
echo 清理完成!按任意鍵結束...
pause
schtasks /create /tn "ClearAllCookies_Daily" /tr "C:\Path\ClearAllCookies.bat" /sc daily /st 03:00 /ru SYSTEM /rl highest
每日凌晨 3 點以 SYSTEM 權限自動執行,維持所有使用者 Cookie/快取乾淨,減少追蹤與磁碟佔用。