Skip to content

Instantly share code, notes, and snippets.

@netravnen
Last active October 21, 2019 22:33
Show Gist options
  • Save netravnen/47f35c5384e176c63ee1750511e81cdd to your computer and use it in GitHub Desktop.
Save netravnen/47f35c5384e176c63ee1750511e81cdd to your computer and use it in GitHub Desktop.
Move Firefox/Chrome/Opera cache folder a ramdisk location (R:)
:: TITLE: move-browser-cache-to-ramdisk.bat
:: BY: GH:netravnen
:: NOTE: Requires administrator rights to run under Windows
:: VERSION: v1.0.0-20180728
:: Google Chrome
IF EXIST "%userprofile%\AppData\Local\Google\Chrome\User Data\Default\Cache" (
rmdir /S /Q "%userprofile%\AppData\Local\Google\Chrome\User Data\Default\Cache"
mklink /D "%userprofile%\AppData\Local\Google\Chrome\User Data\Default\Cache" R:\cache
ECHO Google Chrome cache moved
) ELSE (
ECHO Google Chrome not installed
)
:: Google Chrome Beta
IF EXIST "%userprofile%\AppData\Local\Google\Chrome Beta\User Data\Default\Cache" (
rmdir /S /Q "%userprofile%\AppData\Local\Google\Chrome Beta\User Data\Default\Cache"
mklink /D "%userprofile%\AppData\Local\Google\Chrome Beta\User Data\Default\Cache" R:\cache
ECHO Google Chrome Beta cache moved
) ELSE (
ECHO Google Chrome beta not installed
)
:: Google Chrome Developer
IF EXIST "%userprofile%\AppData\Local\Google\Chrome Dev\User Data\Default\Cache" (
rmdir /S /Q "%userprofile%\AppData\Local\Google\Chrome Dev\User Data\Default\Cache"
mklink /D "%userprofile%\AppData\Local\Google\Chrome Dev\User Data\Default\Cache" R:\cache
ECHO Google Chrome Dev cache moved
) ELSE (
ECHO Google Chrome Dev not installed
)
:: Google Chrome Canary
IF EXIST "%userprofile%\AppData\Local\Google\Chrome SxS\User Data\Default\Cache" (
rmdir /S /Q "%userprofile%\AppData\Local\Google SxS\Chrome\User Data\Default\Cache"
mklink /D "%userprofile%\AppData\Local\Google SxS\Chrome\User Data\Default\Cache" R:\cache
ECHO Google Chrome Canary cache moved
) ELSE (
ECHO Google Chrome Canary not installed
)
:: Opera Stable
IF EXIST "%userprofile%\AppData\Local\Opera Software\Opera Stable\Cache" (
rmdir /S /Q "%userprofile%\AppData\Local\Opera Software\Opera Stable\Cache"
mklink /D "%userprofile%\AppData\Local\Opera Software\Opera Stable\Cache" R:\cache
ECHO Opera Stable cache moved
) ELSE (
ECHO Opera Stable not installed
)
:: Opera Developer
IF EXIST "%userprofile%\AppData\Local\Opera Software\Opera Developer\Cache" (
rmdir /S /Q "%userprofile%\AppData\Local\Opera Software\Opera Developer\Cache"
mklink /D "%userprofile%\AppData\Local\Opera Software\Opera Developer\Cache" R:\cache
ECHO Opera Developer cache moved
) ELSE (
ECHO Opera Developer not installed
)
:: Opera Next
IF EXIST "%userprofile%\AppData\Local\Opera Software\Opera Next\Cache" (
rmdir /S /Q "%userprofile%\AppData\Local\Opera Software\Opera Next\Cache"
mklink /D "%userprofile%\AppData\Local\Opera Software\Opera Next\Cache" R:\cache
ECHO Opera Next cache moved
) ELSE (
ECHO Opera Next not installed
)
:: Mozilla Firefox
IF EXIST "%userprofile%\AppData\Local\Mozilla\Firefox\Profiles" (
rmdir /S /Q "%userprofile%\AppData\Local\Mozilla\Firefox\Profiles"
mklink /D "%userprofile%\AppData\Local\Mozilla\Firefox\Profiles" R:\cache
ECHO Mozilla Firefox cache moved
) ELSE (
ECHO Mozilla Firefox not installed
)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment