TUT-015

Delete_history_and_passwords

delete_history_and_passwords

PublishedAug 11, 2026 Read time3 min Views2 Category Hardware Tags

COpy below code

@echo off :: delete_history_and_passwords.bat :: WARNING: This script PERMANENTLY deletes browsing history AND saved passwords for Chrome, Edge, and Firefox. :: Run as Administrator. Test on one machine first. Users will lose all saved passwords, autofill data, and history. :: Make sure you have backups of any important credentials before running. :: Logs to C:\delete_browser_history_and_passwords_log.txt

:: Check for Admin openfiles >nul 2>&1 if %errorlevel% neq 0 ( echo This script must be run as Administrator. pause exit /b 1 )

set LOG=C:\delete_browser_history_and_passwords_log.txt echo ===== %date% %time% START =====>>“%LOG%” echo WARNING: This will DELETE saved passwords permanently. >>“%LOG%”

echo Killing browser processes… >>“%LOG%” taskkill /IM chrome.exe /F >nul 2>&1 taskkill /IM msedge.exe /F >nul 2>&1 taskkill /IM firefox.exe /F >nul 2>&1 timeout /t 2 >nul

:: ---------- Google Chrome (all profiles) ---------- echo Processing Google Chrome profiles…>>“%LOG%” set CHROME_BASE=%LOCALAPPDATA%\Google\Chrome\User Data if exist “%CHROME_BASE%” ( for /d %%P in (“%CHROME_BASE%*”) do ( if /I “%%~nP” neq “System Profile” ( echo Cleaning Chrome profile %%~nP >>“%LOG%” del /f /q “%%P\History” >nul 2>&1 del /f /q “%%P\History-journal” >nul 2>&1 del /f /q “%%P\Top Sites” >nul 2>&1 del /f /q “%%P\Visited Links” >nul 2>&1 rmdir /s /q “%%P\Cache” >nul 2>&1 rmdir /s /q “%%P\Code Cache” >nul 2>&1 rmdir /s /q “%%P\GPUCache” >nul 2>&1 rem Delete saved passwords (Login Data) del /f /q “%%P\Login Data” >nul 2>&1 del /f /q “%%P\Login Data-journal” >nul 2>&1 del /f /q “%%P\Web Data” >nul 2>&1 del /f /q “%%P\Web Data-journal” >nul 2>&1 echo Chrome profile %%~nP cleared (history + passwords). >>“%LOG%” ) ) ) else ( echo Chrome not found >>“%LOG%” )

:: ---------- Microsoft Edge (all profiles) ---------- echo Processing Microsoft Edge profiles…>>“%LOG%” set EDGE_BASE=%LOCALAPPDATA%\Microsoft\Edge\User Data if exist “%EDGE_BASE%” ( for /d %%P in (“%EDGE_BASE%*”) do ( if /I “%%~nP” neq “System Profile” ( echo Cleaning Edge profile %%~nP >>“%LOG%” del /f /q “%%P\History” >nul 2>&1 del /f /q “%%P\History-journal” >nul 2>&1 rmdir /s /q “%%P\Cache” >nul 2>&1 rmdir /s /q “%%P\GPUCache” >nul 2>&1 rem Delete saved passwords (Login Data) del /f /q “%%P\Login Data” >nul 2>&1 del /f /q “%%P\Login Data-journal” >nul 2>&1 del /f /q “%%P\Web Data” >nul 2>&1 del /f /q “%%P\Web Data-journal” >nul 2>&1 echo Edge profile %%~nP cleared (history + passwords). >>“%LOG%” ) ) ) else ( echo Edge not found >>“%LOG%” )

:: ---------- Firefox (all profiles) ---------- echo Processing Firefox profiles…>>“%LOG%” set FIREFOX_PROFILES=%APPDATA%\Mozilla\Firefox\Profiles if exist “%FIREFOX_PROFILES%” ( for /d %%P in (“%FIREFOX_PROFILES%*”) do ( echo Cleaning Firefox profile %%~nP >>“%LOG%” rem Delete places (history + bookmarks) - WARNING: removes bookmarks too del /f /q “%%P\places.sqlite” >nul 2>&1 del /f /q “%%P\places.sqlite-wal” >nul 2>&1 del /f /q “%%P\places.sqlite-shm” >nul 2>&1 rem Delete saved logins del /f /q “%%P\logins.json” >nul 2>&1 del /f /q “%%P\key4.db” >nul 2>&1 del /f /q “%%P\signons.sqlite” >nul 2>&1 del /f /q “%%P\signons.sqlite-wal” >nul 2>&1 echo Firefox profile %%~nP cleared (history + saved passwords). >>“%LOG%” ) ) else ( echo Firefox not found >>“%LOG%” )

:: Remove Chrome/Edge/Firefox cache/temp leftover in user temp if any echo Cleaning temp cache directories… >>“%LOG%” rmdir /s /q “%LOCALAPPDATA%\Google\Chrome\User Data\Default\Cache” >nul 2>&1 rmdir /s /q “%LOCALAPPDATA%\Microsoft\Edge\User Data\Default\Cache” >nul 2>&1

echo Restarting Explorer… >>“%LOG%” taskkill /f /im explorer.exe >nul 2>&1 start explorer.exe

echo Finished at %date% %time% >>“%LOG%” echo ===== %date% %time% END =====>>“%LOG%”

echo Done. Log: %LOG% pause

Share: Share on Facebook

// Related posts

// Comments (0)

No comments yet. Be the first.