Internet Explorer: Change Temporary Internet File Cache Size via Batch File

   Posted February 13, 2012 by Jimmy Selix in Windows

In a corporate or enterprise environment, changing settings through batch files is a very efficient process. This guide explains how to change the temporary internet file cache size for IE8 or IE9 through the batch method.

Most settings in Internet Explorer can be configured through the operating system’s registry.  This is very handy if you work in a corporate or enterprise environment and need to make a change for multiple computers.  We can make the change without directly forcing the user to make the change or without having a tech go to the user’s desk.  

In my example below I’m using IE9, but IE8 should work the same way.

Setting Initial Values

1. Normally, you can change IE9‘s temporary internet file cache size by going into Tools > Internet Options and then clicking on the Settings button under the “Browsing History” section and then manually entering a value (for example, 250MB).

2. We can accomplish this same setting by changing this registry key using RegEdit.  Open Regedit (by going to Start Menu > Run > type “regedit” or by holding Windows Key + R and then typing “regedit”) and then browse to this key:

HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion \Internet Settings\5.0\Cache\Content\CacheLimit

Double-click on the CacheLimit value. This is the temporary internet file size cache we saw in Step 1. To change this be sure to change the Base to Decimal. Then enter in the size in Kilobytes in the Value Data field. In our example, 256000Kilobytes = 250MB.

This will now change the setting for the currently logged in user.

Now, after setting the value in the Registry, you can in turn export the registry key to deploy or we can create a batch file to execute the registry changes using the REG ADD commands.

Exporting and modifying .REG file

1. Open up Regedit and browse to the key and highlight the Content key on the left pane and then go to File > Export. Save the .reg file as IE9-Temp.reg. This will export the following code:

Windows Registry Editor Version 5.00
[HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\ Internet\5.0\Cache\Content]

2. Notice how the value for CacheLimit is actually in Hexadecimal format. We will need to convert the decimal value to hexadecimal when importing through a .reg file or via the command line using reg add. Here is a quick table of MB to common kilobyte sizes converted to hexadecimal (we’ll need the kilobyte sizes later):

Size in MB = Size in Kilobytes = Hexadecimal value
250MB = 256000 = 3e800
512MB = 524288 = 80000
1024MB = 1048576 = 100000

3. Once you have the .reg file updated with your value. It can be ran via a command line by using this command:

Again, this will change the setting for the user who is importing the reg file.

Modifying registry key with a batch file

1. When modifying this registry setting via a command line and batch file, we will need to use the REG ADD command; however, this will differ in how we pass the size value to the registry. When using a .reg file, we needed the value in hexadecimal form but in this method (via batch file or command line), we will need our value in decimal form and converted to kilobytes.

b. Here is a simple example batch file to update the value to 250MB:

taskkill /F /IM iexplore.exe
reg add "HKCU\Software\Microsoft\Windows\CurrentVersion\Internet Settings\5.0\Cache\Content" /v
CacheLimit /t REG_DWORD /d 256000 /f

Modify the 256000 value to what you want to set your IE9 temp file cache to be. Again, you can refer to my simple chart above for decimal value.


Internet Explorer cannot be running for the change to update, I used a taskkill command to kill all iexplore.exe process in my batch file example. It should also be noted that one could use a dependency rule to check this registry setting to make sure all computers use the same cache file settings in Zenworks or SCM.


About Jimmy Selix

Jimmy Selix is an early adopter that loves to be one of the first on the block to have the latest and greatest in technology and gadgets. Another love of his is being able to share his knowledge to others seeking it. Feel free to drop any comments or questions that you may have.
View more articles by Jimmy Selix

The Conversation

Follow the reactions below and share your own thoughts.