Clearing browser history

Joined
Apr 6, 2015
Messages
342
Reaction score
10
I would like the code for a batchfile to clear Firefox history in x32Win10ProV22H2.
 
Joined
Apr 6, 2015
Messages
342
Reaction score
10
I also asked Google, and got a complex answer which WORKS.
It takes a minute for the batchfile to execute,
but if I click its shortcut, the effect is instantaneous.

Firefox must NOT be open when the batch is run !

>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
REM - substituting 'v7pvfr41.default-release' for '*' renders it ineffective,
REM - even though that is the folder where those 3 sqlite files are held

for /d %%x in (C:\Users\Joe\AppData\Roaming\Mozilla\Firefox\Profiles\*) do (
del /q /s /f "%%x\places.sqlite"
del /q /s /f "%%x\places.sqlite-shm"
del /q /s /f "%%x\places.sqlite-wal"
)
>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>

I would love to know what 'for /d %%x in' does or means
and why it is rendered ineffective when '*' is substituted for.
 

Bastet

Moderator.
Moderator
Joined
Feb 3, 2017
Messages
787
Reaction score
159
This is one I’ve found which deletes history but saves passwords & bookmarks. Firefox must be closed before running.


Code:
@echo off
REM ============================================
REM Batch script to clear Firefox browsing history
REM Tested on Windows 10/11
REM ============================================

REM Close Firefox if running
taskkill /IM firefox.exe /F >nul 2>&1

REM Locate Firefox profile folder
set "FF_PROFILE_DIR=%APPDATA%\Mozilla\Firefox\Profiles"

REM Check if profile directory exists
if not exist "%FF_PROFILE_DIR%" (
    echo Firefox profile folder not found.
    pause
    exit /b 1
)

REM Loop through profiles and delete history database
for /d %%P in ("%FF_PROFILE_DIR%\*") do (
    if exist "%%P\places.sqlite" (
        echo Clearing history in profile: %%~nxP
        del /f /q "%%P\places.sqlite"
        del /f /q "%%P\places.sqlite-shm" 2>nul
        del /f /q "%%P\places.sqlite-wal" 2>nul
    )
)

echo Firefox history cleared successfully.
pause
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top