Microsoft Edge Cache Removal Script

Copper Contributor

Good Morning, Trying to find a way to automate a cache and cookie removal for Microsoft Edge (Chromium). I have reviewed documentation, github, reddit, and other items but there are no true automations to remove cache and cookies. Everything I find leads back to manually clearing within Edge. With internet exporer and the non chromium edge you were able to create scripts, which I have. Any help would be appreciated. 

8 Replies
There's a setting to remove all that data automatically when the browser closes. Would that be sufficient?
Here is the setting steelea was referring to.
https://support.microsoft.com/en-us/microsoft-edge/delete-cookies-in-microsoft-edge-63947406-40ac-c3...

Delete cookies every time you close the browser:
In Edge, select Settings and more > Settings > Privacy, search, and services.

Under Clear browsing data, select Choose what to clear every time you close the browser.

Turn on the Cookies and other site data toggle.

Once this feature is turned on, every time you close your Edge browser all cookies and other site data will be deleted. This signs you out of most sites.

If you need a script, here is a starting point

https://gist.github.com/mark05e/745afaf5604487b804ede2cdc38a977f

Hope this helps!
Best,
bp

@josh_bodner Sadly that would not work. Trying to build out something users can use as they want to clear Edge cache as needed. I proposed that solution and it wasn't the one. Will have to have something that is easily deployable to an end user as a package. 

Hey, I've started out on the scipt and modified the entries, even tried removing all the default edge folders, no luck.
Are you looking for an executable or a script like a batch file? Are you able to try the script I have linked above? You can also try to convert the powershell script to a batch file using something like this https://community.idera.com/database-tools/powershell/powertips/b/tips/posts/converting-powershell-t...
Best.
bp
I've worked with the script above and even tried to manipulate it and can't get the cache, passwords, etc. to clear within chromium edge.
i have same issue in my website https://mp3juices.online/ when i try to open its always purge the cache

@steelea 

The simple solution is to clear the Default Folder under the users profile.   LIke Google Chrome the Edge brower puts all the user data in one location.  Below should help you create a a batch file.  You first kill the tasks for Edge and clear the "Default" folder.   You can go up a level a few folder levels to %localappdata%\Local\Microsoft\Edge\User Data.  However, I found the Default folder the most useful.   If you use One Drive to save favorites you shoud be safe to use the below.  If not you could backup favorites but copying the htm file under the default fold somewhere and copy it back after clearing folder.  Hope this helps

Copy to notepad and save as .cmd or .bat

taskkill /f /IM msedge.exe
taskkill /f /IM msedgewebview2.exe
rmdir /q /s "%localappdata%\Microsoft\Edge\User Data\Default"