遇到很多超级小白,不会清理浏览器缓存,干脆写个代码吧。代码如下,保存为bat文件,即可实现一键清理浏览器缓存。代码如下:

@echo off

echo Clearing browser cache...

set CHROME_DIR=%LOCALAPPDATA%\Google\Chrome\User Data\Default\Cache
set EDGE_DIR=%LOCALAPPDATA%\Microsoft\Edge\User Data\Default\Cache
set FIREFOX_DIR=%LOCALAPPDATA%\Mozilla\Firefox\Profiles\*\cache2\entries

set /p "browser=Enter the browser (chrome, edge, firefox): "

if "%browser%" == "chrome" (
    rd /s /q "%CHROME_DIR%"
    echo Chrome cache has been cleared.
) else if "%browser%" == "edge" (
    rd /s /q "%EDGE_DIR%"
    echo Edge cache has been cleared.
) else if "%browser%" == "firefox" (
    del /f /q "%FIREFOX_DIR%\*.*"
    echo Firefox cache has been cleared.
) else (
    echo Invalid browser name. Please try again.
)

pause

05-14 22:10