Skip to content

Instantly share code, notes, and snippets.

@dave-newson
Created April 14, 2016 03:08
Show Gist options
  • Save dave-newson/14e6e017d8fb475961f6091d6abae886 to your computer and use it in GitHub Desktop.
Save dave-newson/14e6e017d8fb475961f6091d6abae886 to your computer and use it in GitHub Desktop.
:: IE DNS Cache Buster
::
:: Because IE keeps a hold of the DNS Cache for up to 30 minutes.
:: https://support.microsoft.com/en-au/kb/263558
::
:: Created based on
:: http://blog.patrickmeenan.com/2012/11/clearing-ies-caches-not-as-simple-as-it.html
::
:: This is an overly-violent method of killing the web cache, and probably has lots of nightmarish side-effects.
:: If you can, changing the Registry value as mentioned in KB-263558 is probably a lot safer.
:: This has no warranty. I take no responsibility for you using this garbage.
@ECHO OFF
:: Must be administrator
mkdir "%windir%\system32\test" 2>nul
if "%errorlevel%" == "0" (
rmdir "%windir%\system32\test"
) else (
ECHO ERROR: You must run this as administrator.
EXIT /B 1
)
ECHO Clearing IE DNS Cache
ipconfig /flushdns
net stop COMSysApp
FOR /F "usebackq tokens=2" %%i IN (`tasklist ^| findstr /r /b "dllhost\.exe taskhost.*\.exe"`) DO taskkill /pid %%i /F
echo Removing cache files ...
del %USERPROFILE%\AppData\Local\Microsoft\Windows\WebCache\* /Q
net start COMSysApp
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment