This is especially useful when you have a computer that can be accessed by multiple users or public. To do this, you must first prepare a batch file to execute the various commands to clear the IE cache.
There are various cache that you can clear.
Temporary Internet Files
RunDll32.exe InetCpl.cpl,ClearMyTracksByProcess 8
Cookies
RunDll32.exe InetCpl.cpl,ClearMyTracksByProcess 2
History
RunDll32.exe InetCpl.cpl,ClearMyTracksByProcess 1
Form Data
RunDll32.exe InetCpl.cpl,ClearMyTracksByProcess 16
Passwords
RunDll32.exe InetCpl.cpl,ClearMyTracksByProcess 32
Delete All
RunDll32.exe InetCpl.cpl,ClearMyTracksByProcess 255
Delete All - “Also delete files and settings stored by add-ons”
RunDll32.exe InetCpl.cpl,ClearMyTracksByProcess 4351
Simply create a file clearIE.bat and type in the command you want, corresponding to the cache that you want to clear. You can also combine multiple commands in the same clearIE.bat to achieve the result you wanted.
Next, fire up Group Policy Editor. Go to Start, Run, then type in gpedit.msc and hit OK.
There are 2 parts after this, depending if you want to clear the cache during logoff or shutdown.
To clear cache during logoff
- Inside Group Policy Editor, expand User Configuration > Windows Setting > Scripts (Logon/Logoff).
- On the right panel, select Logoff, right click and select Properties.
- On Logoff Properties window, click on Add.
- On Add a script window, click on Browse, navigate to the location where clearIE.bat is at, select it and click Open.
- Click OK, Apply then OK.
To clear cache during shutdown
- Inside Group Policy Editor, expand Computer Configuration > Windows Setting > Scripts (Startup/Shutdown).
- On the right panel, select Shutdown, right click and select Properties.
- On Shutdown Properties window, click on Add.
- On Add a script window, click on Browse, navigate to the location where clearIE.bat is at, select it and click Open.
- Click OK, Apply then OK.
That’s all. Just do some logoff and shutdown to make sure that the batch file is working.