How to delete Chrome temp data (history, cookies, cache) using command line

14

5

On Windows 7, I tried running this script but still cannot clear Chrome temp data. Can someone figure out what's wrong with the script? Where do Chrome store history and cache ? Thanks

ECHO --------------------------------------
ECHO **** Clearing Chrome cache
taskkill /F /IM "chrome.exe">nul 2>&1

set ChromeDataDir=C:\Users\%USERNAME%\AppData\Local\Google\Chrome\User Data\Default
set ChromeCache=%ChromeDataDir%\Cache>nul 2>&1  
del /q /s /f "%ChromeCache%\*.*">nul 2>&1    
del /q /f "%ChromeDataDir%\*Cookies*.*">nul 2>&1    
del /q /f "%ChromeDataDir%\*History*.*">nul 2>&1    


set ChromeDataDir=C:\Users\%USERNAME%\Local Settings\Application Data\Google\Chrome\User Data\Default
set ChromeCache=%ChromeDataDir%\Cache>nul 2>&1
del /q /s /f "%ChromeCache%\*.*">nul 2>&1   
del /q /f "%ChromeDataDir%\*Cookies*.*">nul 2>&1    
del /q /f "%ChromeDataDir%\*History*.*">nul 2>&1    
ECHO **** Clearing Chrome cache DONE

Dio Phung

Posted 2012-11-22T06:09:55.090

Reputation: 739

Answers

5

Actually my script works. The reason Omnibox history is not cleared because I chose to sync data to Google Account. So after running the script, if you reopen Chrome, it will restore Omnibox history. Thanks to @Sathya for the comment

Dio Phung

Posted 2012-11-22T06:09:55.090

Reputation: 739

1

Please check if it is having any permission issues. Try running the batch file with additional privileges (run as admin).

OR

Try opening the command prompt and type the commands one by one and check the response to identify where exactly it fails.

Vimal Raj

Posted 2012-11-22T06:09:55.090

Reputation: 131

I am running it with admin account. The script doesn't failed, it deleted files, but the history (OmniBar, search keyword..etc) is not cleared – Dio Phung – 2012-11-22T07:48:47.467

6@DioPhung if you've enabled sync, then they're sync'd to your Google account – Sathyajith Bhat – 2012-11-22T08:05:42.460

@Sathya : yeah you're right, OmniBox history is sync'd to Google. +1 for that hint ;) ! – Dio Phung – 2012-11-23T02:48:14.007