When using Windows, it occasionally becomes necessary to flush your DNS Resolver Cache for one reason or another.
The DNS cache (also known as DNS resolver cache) is a temporary DNS storage on a device that contains DNS records of already visited domain names. The reason it stores these records is so that the device doesn’t have to visit the domain name server each time you visit a specified website.
Like all caches, the DNS resolver cache can become huge, and it is prone to corruption for whatever reason. Also, websites can change their DNS parameters without the local machine knowing; therefore, you may type in the web address of a certain website one day and your machine finds the relevant server’s IP address in the DNS resolver cache, yet the next time you try to visit that particular website, it has relocated to a different server with a new IP address, yet your DNS cache still says that it is at the old address, and as a result your machine can’t resolve the DNS entry.
The way to avoid the above happening again is to flush your DNS resolver cache and allow the device to visit the DNS server again as it connects with the website. The changed DNS entry will then be stored in the cleared DNS resolver cache and used for future visits.
If you want to do this operation the manual way, you have to call up a command prompt and type in a short code to clear the cache, following which you should type “exit” in the window, return, and proceed. – What a palaver!
Wouldn’t it be so much nicer to be able to flush the DNS resolver cache with a single click?
Believe it or not; this can be done. – Let’s look at a shortcut you can create to help keep your computer working nominally.
Here’s how it’s done: –
To set up the one-click-any-time operation, we first need to create an appropriate batch file: –
Open a new .txt (text) document on your Desktop and title it “Flush DNS Resolver Cache” – so that it reads ‘Flush DNS Resolver Cache.txt’.
Populate the text document with the following: –
@echo off
ECHO Flushing DNS Resolver Cache...
ipconfig /flushdns
pause
exit
(‘Pause’ and ‘exit’ probably aren’t absolutely necessary; but I included them for extra functionality in the batch file that I personally use anyway.)
Now close the text document and right-click the file’s icon on the Desktop and select ‘Rename’.
Click after the .txt in the icon’s name and delete the letters ‘txt’ after the point. Don’t click away.
Replace the letters ‘txt’ with ‘bat’. – Now click away.
Windows will put up a dialog saying: –
“If you change a filename extension. the file might become unusable.
Are you sure you want to change it?”
Click “Yes”.
You’ve just created the batch file you need. – But there’s more: –
Drag the batch file you’ve created to somewhere that’s not on your Desktop.
Now right-click the batch file’s icon and create a shortcut to it.
Drag the shortcut you just created to your desktop and rename it
“Flush DNS Resolver Cache”.
Now, every time you click the shortcut titled “Flush DNS Resolver Cache”, your computer will open a command window on your screen and flush the DNS resolver cache
– If, at any point, you want to flush the DNS resolver cache without having created the button; just run a command prompt as administrator, type “ipconfig / flushdns
”, and press return.
– But it’s easier to just do it with a single click.
* Further reading about the DNS resolver cache
Other titles on this site involving creation of batch files are: –