Skip navigation

JSI Tip 6985. How can I configure the Internet Explorer Temporary Internet Files cache size from a command line?

I have scripted CacheLimit.bat to allow you to set the Internet Explorer Temporary Internet Files cache size from a command line, including from a logon script.

The syntax for using CacheLimit.bat is:

call cachelimit NumberOfMegaBytes

where NumberOfMegaBytes is the cache size in megabytes.

NOTE: CacheLimit.bat calls Dec2Hex.

NOTE: After calling CacheLimit.bat, the Temporary Internet Files cache size that you set will be used the next time that Internet Explorer is started.

CacheLimit.bat contains:

@echo off
setlocal
if \{%1\}==\{\} goto syntax
set /a MB=%1
set /a KB=%MB% * 1024
:: Delete the above line if you wish to set the cache in kilobytes.
set work=00000000
call Dec2Hex %KB% HexKB HexChar
if %HexChar% EQU 0 goto Syntax
if %HexChar% EQU 8 set Cache=%HexKB%&goto out
set /a FillChar=8 - %HexChar%
call set Cache=%%work:~0^,%FillChar%%%%HexKB%
:out
set file=%TEMP%\CacheLimit.reg
@echo REGEDIT4>%file%
@echo.>>%file%
@echo \[HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Internet Settings\5.0\Cache\Content\]>>%file%
@echo "CacheLimit"=dword:%Cache%>>%file%
@echo.>>%file%
@echo \[HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Internet Settings\Cache\Content\]>>%file%
@echo "CacheLimit"=dword:%Cache%>>%file%
@echo.>>%file%
regedit /s %file%
del /q %file%
endlocal
goto :EOF
:syntax
@echo Syntax:  Call CacheLimit NumberOfMegaBytes
endlocal



Hide comments

Comments

  • Allowed HTML tags: <em> <strong> <blockquote> <br> <p>

Plain text

  • No HTML tags allowed.
  • Web page addresses and e-mail addresses turn into links automatically.
  • Lines and paragraphs break automatically.
Publish