JSI Tip 9252. How can I set the number of days worth or URL history to keep?

When you use the Internet Explorer Tools menu to open Internet Options, the General tab allows you to configure Days to keep pages in history.

You can change this value in a batch, or logon script, by setting the DaysToKeep Value Name, a REG_DWORD data type, at HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Internet Settings\Url History.

Examples of setting DaysToKeep to 3:

Using REG.EXE, built into Windows XP, Windows Server 2003, and later, or installed from the Windows 2000 Support Tools on the operating system CD-ROM:

REG ADD "HKCU\Software\Microsoft\Windows\CurrentVersion\Internet Settings\Url History" /V DaysToKeep /T REG_DWORD /F /D 3


Regedit /s FileName.reg

Where FileName.reg contains:


\[HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Internet Settings\Url History\]

Using a batch to generate a .REG file:

@echo off
set rf="%TEMP%\DaysToKeep_%RANDOM%.TMP"
@echo REGEDIT4
@echo \[HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Internet Settings\Url History\]
@echo "DaysToKeep"=dword:00000003
regedit /s %rf%
del /q %rf%

Hide 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.