Chrome cache reset
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Chrome app location | |
$App = "${env:ProgramFiles(x86)}\Google\Chrome\Application\chrome.exe" | |
# Chrome user data location | |
$UserFolder = "${env:LOCALAPPDATA}\Google\Chrome\User Data\Default" | |
# Chrome datastores | |
$CacheData = @( | |
'Cookies' | |
'Web Data' | |
'Cache\*' | |
'Sessions\*' | |
'Session Storage\*' | |
'Service Worker\*' | |
'Local Storage\*' | |
'IndexedDB\*' | |
) | |
# Arguments to pass to chrome on launch | |
$LaunchArgs = @( | |
# Prompt user to sign into chrome on relaunch | |
'https://accounts.google.com/signin/chrome/sync/identifier?flowName=GlifDesktopChromeSync' | |
'--disable-gpu' | |
'--disable-software-rasterizer' | |
) | |
# Find & terminate all Chrome processes | |
Get-Process -Name 'chrome' | Stop-Process | |
# Wait for all processes to terminate | |
Get-Process | Where-Object {$_.HasExited} | |
# Clear target cached data | |
$CacheData | ForEach-Object { | |
if (Test-Path "$UserFolder\$_") { | |
Remove-Item "$UserFolder\$_" -Recurse -Verbose | |
} | |
} | |
# Restart Chrome | |
Start-Process $App -ArgumentList $LaunchArgs -WindowStyle Maximized |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment