Skip to content

Instantly share code, notes, and snippets.

What would you like to do?
Chrome cache reset
# 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 = @(
'Web Data'
'Session Storage\*'
'Service Worker\*'
'Local Storage\*'
# Arguments to pass to chrome on launch
$LaunchArgs = @(
# Prompt user to sign into chrome on relaunch
# 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