Without deleting Chrome bookmarks, how to delete cookies, cache and history with a batch file
Sophia Terry
Below is the script I am using which is deleting bookmarks as well:
@echo off
set ChromeDir=C:\Users\%UserName%\AppData\Local\Google\Chrome\User Data
del /q /s /f "%ChromeDir%"
rd /s /q "%ChromeDir%" 2 Answers
From my testing, it seems you can backup the Bookmarks file in C:\Users\%UserName%\AppData\Local\Google\Chrome\User Data\Default, delete the folder and then restore it.
I created the following batch file based on yours:
@echo off
set TempDir=%TEMP%\ChromeBookmarks
set ChromeDir=C:\Users\%UserName%\AppData\Local\Google\Chrome\User Data
mkdir "%TempDir%"
copy "%ChromeDir%\Default\Bookmarks" "%TempDir%"
del /q /s /f "%ChromeDir%"
rd /s /q "%ChromeDir%"
mkdir "%ChromeDir%\Default"
copy "%TempDir%\Bookmarks" "%ChromeDir%\Default"
del /q /s /f "%TempDir%"
rd /s /q "%TempDir%"This backs up the Bookmarks file before removing the User Data directory and restores it after. When you then open Chrome, it will use the existing Bookmarks file and refill the rest of the User Data directory with new data.
Follow this step:
open chrome goto
Settings->Bookmarks->Bookmark Managerand then Export bookmark as html file and save it to desktop.Then run your batch file it will delete all cookies, cache, history and bookmark also.
But now you have a backup of your Bookmarks on your desktop so now all you have to do is open chrome again and goto
Settings->Bookmarks->Bookmark Managerand import bookmark from that html file.