Click here for Table of Contents

Last Updated

VBS Scripts for Clearing Explorer's and Internet Explorer's Most Recently Used (MRU) Lists

Copy each of these into a New Text Document (use Notepad) and name with a vbs extension. The name needs to be enclosed in quotation marks in notepad else notpad with add a .txt suffix to the name.

Clear Run MRU.vbs

'ClearRunMRU.vbs
'Selectively clears individual items from the Start  - Run dialog box MRU list.
'
'Serenity Macros 	http://www.angelfire.com/biz/serenitymacros 
'David Candy	davidc@sia.net.au
'
On Error Resume Next
strExplain="ClearRunMRU clears individual items from the Start - Run MRU (a list of recently run commands)." & vbCRLF & "The program will prompt for each item in the list." & vbCRLF & vbCRLF
strTitle="Clear Run MRU"

Dim Sh
Set Sh = WScript.CreateObject("WScript.Shell")
ReportErrors "Creating Shell"
Sh.RegWrite "HKLM\Software\Microsoft\Windows\CurrentVersion\App Paths\" & Wscript.ScriptName & "\", Chr(34) & Wscript.ScriptFullName & Chr(34) 
Sh.RegWrite "HKLM\Software\Microsoft\Windows\CurrentVersion\App Paths\" & Left(Wscript.ScriptName, Len(Wscript.ScriptName)-3) & "exe" & "\", Chr(34) & Wscript.ScriptFullName & Chr(34) 
ReportErrors "Updating App Paths"
MRUList=Sh.RegRead("HKCU\Software\Microsoft\Windows\CurrentVersion\Explorer\RunMRU\MRUList")
If Err.Number=-2147024894 then 
	Err.Clear
	MRUList=0
Else
	MRUNo=Len(MRUList)
End If

If MsgBox (strExplain & "Number of entries" & vbtab & MRUNo & vbCRLF & vbCRLF & "Continue?", vbYesNo + vbInformation, strTitle) = 6 then
	Dim MRUItem()
	ReDim Preserve MRUItem(0)
	For x=0 to MRUNo - 1
		MItem=Sh.RegRead("HKCU\Software\Microsoft\Windows\CurrentVersion\Explorer\RunMRU\" & Mid(MRUList,x+1,1))
		Sh.Regdelete "HKCU\Software\Microsoft\Windows\CurrentVersion\Explorer\RunMRU\" & Mid(MRUList,x+1,1)
		If MsgBox ("Do you want to delete " & vbcrlf & vbcrlf & Left(MItem,Len(MItem)-2) & vbcrlf & vbcrlf & "Yes" & vbtab & "To delete" & vbcrlf & "No" & vbtab & "To keep", vbYesNo + vbQuestion, strTitle) <> 6 then
			ReDim Preserve MRUItem(UBound(MRUItem)+1)
			MRUItem(UBound(MRUItem))=MItem
		End If
	Next
	MRUList=""
	For y=1 to UBound(MRUItem) 
		MRUList=MRUList & Chr(y + 96)
		Sh.RegWrite "HKCU\Software\Microsoft\Windows\CurrentVersion\Explorer\RunMRU\" & Chr(y + 96),MRUItem(y)
	Next
	Sh.RegWrite "HKCU\Software\Microsoft\Windows\CurrentVersion\Explorer\RunMRU\MRUList", MRUList
	Msgbox "Click Start - Shutdown Windows then Cancel to allow changes to take effect.", vbInformation + vbOKOnly, strTitle
End If


VisitSerenity
ReportErrors(test)

Sub ReportErrors(strModuleName)
	If err.number<>0 then Msgbox "An unexpected error occurred. This dialog provides details on the error." & vbCRLF & vbCRLF & "Error Details " & vbCRLF & vbCRLF & "Script Name" & vbTab & Wscript.ScriptFullName & vbCRLF & "Module" & vbtab & vbTab & strModuleName & vbCRLF & "Error Number" & vbTab & err.number & vbCRLF & "Description" & vbTab & err.description, vbCritical + vbOKOnly, "Something unexpected"
	Err.clear
End Sub


Sub VisitSerenity
	If MsgBox("This program came from the Serenity Macros Web Site" & vbCRLF & vbCRLF & "Would you like to visit Serenity's Web Site now?", vbQuestion + vbYesNo + vbDefaultButton2, "Visit Serenity Macros") =6 Then
		sh.Run "http:\\www.angelfire.com\biz\serenitymacros"
	End If
End Sub

Clear Find Printer MRU.vbs

'ClearFindPrinterMRU.vbs
'Selectively clears individual items from the Start  - Printer dialog box MRU list.
'
'Serenity Macros 	http://www.angelfire.com/biz/serenitymacros 
'David Candy	davidc@sia.net.au
'
On Error Resume Next
strExplain="ClearFindPrinterMRU clears individual items from the Find Printer MRU (a list of Printers recently searched for)." & vbCRLF & "The program will prompt for each item in the list." & vbCRLF & vbCRLF
strTitle="Clear Find Printer MRU"

Dim Sh
Set Sh = WScript.CreateObject("WScript.Shell")
ReportErrors "Creating Shell"
Sh.RegWrite "HKLM\Software\Microsoft\Windows\CurrentVersion\App Paths\" & Wscript.ScriptName & "\", Chr(34) & Wscript.ScriptFullName & Chr(34) 
Sh.RegWrite "HKLM\Software\Microsoft\Windows\CurrentVersion\App Paths\" & Left(Wscript.ScriptName, Len(Wscript.ScriptName)-3) & "exe" & "\", Chr(34) & Wscript.ScriptFullName & Chr(34) 
ReportErrors "Updating App Paths"
MRUList=Sh.RegRead("HKCU\Software\Microsoft\Windows\CurrentVersion\Explorer\PrnPortsMRU\MRUList")
If Err.Number=-2147024894 then 
	Err.Clear
	MRUList=0
Else
	MRUN=Len(MRUList)
End If

If MsgBox (strExplain & "Number of entries" & vbtab & MRUN & vbCRLF & vbCRLF & "Continue?", vbYesNo + vbInformation, strTitle) = 6 then
	Dim MRUItem()
	ReDim Preserve MRUItem(0)
	For x=0 to MRUN - 1
		MItem=Sh.RegRead("HKCU\Software\Microsoft\Windows\CurrentVersion\Explorer\PrnPortsMRU\" & Mid(MRUList,x+1,1))
		Sh.Regdelete "HKCU\Software\Microsoft\Windows\CurrentVersion\Explorer\PrnPortsMRU\" & Mid(MRUList,x+1,1)
		If MsgBox ("Do you want to delete " & vbcrlf & vbcrlf & MItem & vbcrlf & vbcrlf & "Yes" & vbtab & "To delete" & vbcrlf & "No" & vbtab & "To keep", vbYesNo + vbQuestion, strTitle) <> 6 then
			ReDim Preserve MRUItem(UBound(MRUItem)+1)
			MRUItem(UBound(MRUItem))=MItem
		End If
	Next
	MRUList=""
	For y=1 to UBound(MRUItem) 
		MRUList=MRUList & Chr(y + 96)
		Sh.RegWrite "HKCU\Software\Microsoft\Windows\CurrentVersion\Explorer\PrnPortsMRU\" & Chr(y + 96),MRUItem(y)
	Next
	Sh.RegWrite "HKCU\Software\Microsoft\Windows\CurrentVersion\Explorer\PrnPortsMRU\MRUList", MRUList
	Msgbox "Restart Windows to allow changes to take effect.", vbInformation + vbOKOnly, strTitle
End If


VisitSerenity
ReportErrors(test)


Sub ReportErrors(strModuleName)
	If err.number<>0 then Msgbox "An unexpected error occurred. This dialog provides details on the error." & vbCRLF & vbCRLF & "Error Details " & vbCRLF & vbCRLF & "Script Name" & vbTab & Wscript.ScriptFullName & vbCRLF & "Module" & vbtab & vbTab & strModuleName & vbCRLF & "Error Number" & vbTab & err.number & vbCRLF & "Description" & vbTab & err.description, vbCritical + vbOKOnly, "Something unexpected"
	Err.clear
End Sub



Sub VisitSerenity
	If MsgBox("This program came from the Serenity Macros Web Site" & vbCRLF & vbCRLF & "Would you like to visit Serenity's Web Site now?", vbQuestion + vbYesNo + vbDefaultButton2, "Visit Serenity Macros") =6 Then
		sh.Run "http:\\www.angelfire.com\biz\serenitymacros"
	End If
End Sub

Clear Find MRU.vbs

'ClearFindMRU.vbs
'Selectively clears individual items from the Start  - Find dialog box MRU list.
'
'Serenity Macros 	http://www.angelfire.com/biz/serenitymacros 
'David Candy	davidc@sia.net.au
'
On Error Resume Next
strExplain="ClearFindMRU clears individual items from the Start - Find Folder MRU (a list of files recently searched for)." & vbCRLF & "The program will prompt for each item in the list." & vbCRLF & vbCRLF
strTitle="Clear Find MRU"

Dim Sh
Set Sh = WScript.CreateObject("WScript.Shell")
ReportErrors "Creating Shell"
Sh.RegWrite "HKLM\Software\Microsoft\Windows\CurrentVersion\App Paths\" & Wscript.ScriptName & "\", Chr(34) & Wscript.ScriptFullName & Chr(34) 
Sh.RegWrite "HKLM\Software\Microsoft\Windows\CurrentVersion\App Paths\" & Left(Wscript.ScriptName, Len(Wscript.ScriptName)-3) & "exe" & "\", Chr(34) & Wscript.ScriptFullName & Chr(34) 
ReportErrors "Updating App Paths"
MRUList=Sh.RegRead("HKCU\Software\Microsoft\Windows\CurrentVersion\Explorer\Doc Find Spec MRU\MRUList")
If Err.Number=-2147024894 then 
	Err.Clear
	MRUList=0
Else
	MRUNo=Len(MRUList)
End If

If MsgBox (strExplain & "Number of entries" & vbtab & MRUNo & vbCRLF & vbCRLF & "Continue?", vbYesNo + vbInformation, strTitle) = 6 then
	Dim MRUItem()
	ReDim Preserve MRUItem(0)
	For x=0 to MRUNo - 1
		MItem=Sh.RegRead("HKCU\Software\Microsoft\Windows\CurrentVersion\Explorer\Doc Find Spec MRU\" & Mid(MRUList,x+1,1))
		Sh.Regdelete "HKCU\Software\Microsoft\Windows\CurrentVersion\Explorer\Doc Find Spec MRU\" & Mid(MRUList,x+1,1)
		If MsgBox ("Do you want to delete " & vbcrlf & vbcrlf & MItem & vbcrlf & vbcrlf & "Yes" & vbtab & "To delete" & vbcrlf & "No" & vbtab & "To keep", vbYesNo + vbQuestion, strTitle) <> 6 then
			ReDim Preserve MRUItem(UBound(MRUItem)+1)
			MRUItem(UBound(MRUItem))=MItem
		End If
	Next
	MRUList=""
	For y=1 to UBound(MRUItem) 
		MRUList=MRUList & Chr(y + 96)
		Sh.RegWrite "HKCU\Software\Microsoft\Windows\CurrentVersion\Explorer\Doc Find Spec MRU\" & Chr(y + 96),MRUItem(y)
	Next
	Sh.RegWrite "HKCU\Software\Microsoft\Windows\CurrentVersion\Explorer\Doc Find Spec MRU\MRUList", MRUList
End If


VisitSerenity
ReportErrors(test)


Sub ReportErrors(strModuleName)
	If err.number<>0 then Msgbox "An unexpected error occurred. This dialog provides details on the error." & vbCRLF & vbCRLF & "Error Details " & vbCRLF & vbCRLF & "Script Name" & vbTab & Wscript.ScriptFullName & vbCRLF & "Module" & vbtab & vbTab & strModuleName & vbCRLF & "Error Number" & vbTab & err.number & vbCRLF & "Description" & vbTab & err.description, vbCritical + vbOKOnly, "Something unexpected"
	Err.clear
End Sub


Sub VisitSerenity
	If MsgBox("This program came from the Serenity Macros Web Site" & vbCRLF & vbCRLF & "Would you like to visit Serenity's Web Site now?", vbQuestion + vbYesNo + vbDefaultButton2, "Visit Serenity Macros") =6 Then
		sh.Run "http:\\www.angelfire.com\biz\serenitymacros"
	End If
End Sub

Clear Find Computer MRU.vbs

'ClearFindComputerMRU.vbs
'Selectively clears individual items from the Start  - Find dialog box MRU list.
'
'Serenity Macros 	http://www.angelfire.com/biz/serenitymacros 
'David Candy	davidc@sia.net.au
'
On Error Resume Next
strExplain="ClearFindComputerMRU clears individual items from the Start - Find Computer MRU (a list of computers recently searched for)." & vbCRLF & "The program will prompt for each item in the list." & vbCRLF & vbCRLF
strTitle="Clear Find Computer MRU"

Dim Sh
Set Sh = WScript.CreateObject("WScript.Shell")
ReportErrors "Creating Shell"
Sh.RegWrite "HKLM\Software\Microsoft\Windows\CurrentVersion\App Paths\" & Wscript.ScriptName & "\", Chr(34) & Wscript.ScriptFullName & Chr(34) 
Sh.RegWrite "HKLM\Software\Microsoft\Windows\CurrentVersion\App Paths\" & Left(Wscript.ScriptName, Len(Wscript.ScriptName)-3) & "exe" & "\", Chr(34) & Wscript.ScriptFullName & Chr(34) 
ReportErrors "Updating App Paths"
MRUList=Sh.RegRead("HKCU\Software\Microsoft\Windows\CurrentVersion\Explorer\FindComputerMRU\MRUList")
If Err.Number=-2147024894 then 
	Err.Clear
	MRUList=0
Else
	MRUN=Len(MRUList)
End If

If MsgBox (strExplain & "Number of entries" & vbtab & MRUN & vbCRLF & vbCRLF & "Continue?", vbYesNo + vbInformation, strTitle) = 6 then
	Dim MRUItem()
	ReDim Preserve MRUItem(0)
	For x=0 to MRUN - 1
		MItem=Sh.RegRead("HKCU\Software\Microsoft\Windows\CurrentVersion\Explorer\FindComputerMRU\" & Mid(MRUList,x+1,1))
		Sh.Regdelete "HKCU\Software\Microsoft\Windows\CurrentVersion\Explorer\FindComputerMRU\" & Mid(MRUList,x+1,1)
		If MsgBox ("Do you want to delete " & vbcrlf & vbcrlf & MItem & vbcrlf & vbcrlf & "Yes" & vbtab & "To delete" & vbcrlf & "No" & vbtab & "To keep", vbYesNo + vbQuestion, strTitle) <> 6 then
			ReDim Preserve MRUItem(UBound(MRUItem)+1)
			MRUItem(UBound(MRUItem))=MItem
		End If
	Next
	MRUList=""
	For y=1 to UBound(MRUItem) 
		MRUList=MRUList & Chr(y + 96)
		Sh.RegWrite "HKCU\Software\Microsoft\Windows\CurrentVersion\Explorer\FindComputerMRU\" & Chr(y + 96),MRUItem(y)
	Next
	Sh.RegWrite "HKCU\Software\Microsoft\Windows\CurrentVersion\Explorer\FindComputerMRU\MRUList", MRUList
End If


VisitSerenity
ReportErrors(test)


Sub ReportErrors(strModuleName)
	If err.number<>0 then Msgbox "An unexpected error occurred. This dialog provides details on the error." & vbCRLF & vbCRLF & "Error Details " & vbCRLF & vbCRLF & "Script Name" & vbTab & Wscript.ScriptFullName & vbCRLF & "Module" & vbtab & vbTab & strModuleName & vbCRLF & "Error Number" & vbTab & err.number & vbCRLF & "Description" & vbTab & err.description, vbCritical + vbOKOnly, "Something unexpected"
	Err.clear
End Sub


Sub VisitSerenity
	If MsgBox("This program came from the Serenity Macros Web Site" & vbCRLF & vbCRLF & "Would you like to visit Serenity's Web Site now?", vbQuestion + vbYesNo + vbDefaultButton2, "Visit Serenity Macros") =6 Then
		sh.Run "http:\\www.angelfire.com\biz\serenitymacros"
	End If
End Sub

Clear Any Folder MRU.vbs

This clears the Any Folder MRU part of the Send To Powertoys. The Send To powertoys need to be installed.

'ClearAnyFolderMRU.vbs
'Selectively clears individual items from the Send To - Any Folder dialog box MRU list.
'
'Serenity Macros 	http://www.angelfire.com/biz/serenitymacros 
'David Candy	davidc@sia.net.au
'
On Error Resume Next
strExplain="ClearAnyFolderMRU clears individual items from the Send To - Any Folder MRU (a list of folders recently used)." & vbCRLF & vbCRLF &  "The Send To Any Folder is part of the Windows 95 power toys. This part of the power toys is safe to use with Windows 98, how ever it requires special installations. See the Serenity Macros web site Send To page for information how."  & vbCRLF & vbCRLF &  "The program will prompt for each item in the list." & vbCRLF & vbCRLF
strTitle="Clear Send To Any Folder MRU"

Dim Sh
Set Sh = WScript.CreateObject("Wscript.Shell")
ReportErrors "Creating Shell"
Sh.RegWrite "HKLM\Software\Microsoft\Windows\CurrentVersion\App Paths\" & Wscript.ScriptName & "\", Chr(34) & Wscript.ScriptFullName & Chr(34) 
Sh.RegWrite "HKLM\Software\Microsoft\Windows\CurrentVersion\App Paths\" & Left(Wscript.ScriptName, Len(Wscript.ScriptName)-3) & "exe" & "\", Chr(34) & Wscript.ScriptFullName & Chr(34) 
ReportErrors "Updating App Paths"
MRUList=Sh.RegRead("HKCU\Software\Microsoft\Windows\CurrentVersion\Explorer\OtherFolder\MRUList")
If Err.Number=-2147024894 then 
	Err.Clear
	MRUList=0
Else
	MRUNo=Len(MRUList)
End If

If MsgBox (strExplain & "Number of entries" & vbtab & MRUNo & vbCRLF & vbCRLF & "Continue?", vbYesNo + vbInformation, strTitle) = 6 then
	Dim MRUItem()
	ReDim Preserve MRUItem(0)
	For x=0 to MRUNo - 1
		MItem=Sh.RegRead("HKCU\Software\Microsoft\Windows\CurrentVersion\Explorer\OtherFolder\" & Mid(MRUList,x+1,1))
		Sh.Regdelete "HKCU\Software\Microsoft\Windows\CurrentVersion\Explorer\OtherFolder\" & Mid(MRUList,x+1,1)
		If MsgBox ("Do you want to delete " & vbcrlf & vbcrlf & MItem & vbcrlf & vbcrlf & "Yes" & vbtab & "To delete" & vbcrlf & "No" & vbtab & "To keep", vbYesNo + vbQuestion, strTitle) <> 6 then
			ReDim Preserve MRUItem(UBound(MRUItem)+1)
			MRUItem(UBound(MRUItem))=MItem
		End If
	Next
	MRUList=""
	For y=1 to UBound(MRUItem) 
		MRUList=MRUList & Chr(y + 96)
		Sh.RegWrite "HKCU\Software\Microsoft\Windows\CurrentVersion\Explorer\OtherFolder\" & Chr(y + 96),MRUItem(y)
	Next
	Sh.RegWrite "HKCU\Software\Microsoft\Windows\CurrentVersion\Explorer\OtherFolder\MRUList", MRUList
	Msgbox "Send To Any Folder MRU list has been updated.", vbInformation + vbOKOnly, strTitle
End If


VisitSerenity
ReportErrors(test)

Sub ReportErrors(strModuleName)
	If err.number<>0 then Msgbox "An unexpected error occurred. This dialog provides details on the error." & vbCRLF & vbCRLF & "Error Details " & vbCRLF & vbCRLF & "Script Name" & vbTab & Wscript.ScriptFullName & vbCRLF & "Module" & vbtab & vbTab & strModuleName & vbCRLF & "Error Number" & vbTab & err.number & vbCRLF & "Description" & vbTab & err.description, vbCritical + vbOKOnly, "Something unexpected"
	Err.clear
End Sub


Sub VisitSerenity
	If MsgBox("This program came from the Serenity Macros Web Site" & vbCRLF & vbCRLF & "Would you like to visit Serenity's Web Site now?", vbQuestion + vbYesNo + vbDefaultButton2, "Visit Serenity Macros") =6 Then
		sh.Run "http:\\www.angelfire.com\biz\serenitymacros"
	End If
End Sub

Sub RegisterScriptPath
Sh.RegWrite "HKLM\Software\Microsoft\Windows\CurrentVersion\App Paths\" & Wscript.ScriptName, Wscript.ScriptFullName
End Sub

Clear Install From Location MRU.vbs

This clears the Install From MRU of Windows Setup and Driver Installation.

'ClearInstallMRU.vbs
'Selectively clears individual items from the Install From dialog box MRU list.
'
'Serenity Macros 	http://www.angelfire.com/biz/serenitymacros 
'David Candy	davidc@sia.net.au
'
On Error Resume Next
strExplain="ClearInstallMRU clears individual items from the Install From MRU." & vbCRLF & "The program will prompt for each item in the list." & vbCRLF & vbCRLF
strTitle="Clear Install MRU"

Dim Sh
Set Sh = WScript.CreateObject("WScript.Shell")
ReportErrors "Creating Shell"
Sh.RegWrite "HKLM\Software\Microsoft\Windows\CurrentVersion\App Paths\" & Wscript.ScriptName & "\", Chr(34) & Wscript.ScriptFullName & Chr(34) 
Sh.RegWrite "HKLM\Software\Microsoft\Windows\CurrentVersion\App Paths\" & Left(Wscript.ScriptName, Len(Wscript.ScriptName)-3) & "exe" & "\", Chr(34) & Wscript.ScriptFullName & Chr(34) 
ReportErrors "Updating App Paths"
MRUList=Sh.RegRead("HKCU\InstallLocationsMRU\MRUList")
If Err.Number=-2147024894 then 
	Err.Clear
	MRUList=0
Else
	MRUNo=Len(MRUList)
End If

If MsgBox (strExplain & "Number of entries" & vbtab & MRUNo & vbCRLF & vbCRLF & "Continue?", vbYesNo + vbInformation, strTitle) = 6 then
	Dim MRUItem()
	ReDim Preserve MRUItem(0)
	For x=0 to MRUNo - 1
		MItem=Sh.RegRead("HKCU\InstallLocationsMRU\" & Mid(MRUList,x+1,1))
		Sh.Regdelete "HKCU\InstallLocationsMRU\" & Mid(MRUList,x+1,1)
		If MsgBox ("Do you want to delete " & vbcrlf & vbcrlf & MItem & vbcrlf & vbcrlf & "Yes" & vbtab & "To delete" & vbcrlf & "No" & vbtab & "To keep", vbYesNo + vbQuestion, strTitle) <> 6 then
			ReDim Preserve MRUItem(UBound(MRUItem)+1)
			MRUItem(UBound(MRUItem))=MItem
		End If
	Next
	MRUList=""
	For y=1 to UBound(MRUItem) 
		MRUList=MRUList & Chr(y + 96)
		Sh.RegWrite "HKCU\InstallLocationsMRU\" & Chr(y + 96),MRUItem(y)
	Next
	Sh.RegWrite "HKCU\InstallLocationsMRU\MRUList", MRUList
	Msgbox "The Install From MRU list has been updated.", vbInformation + vbOKOnly, strTitle
End If


VisitSerenity
ReportErrors(test)

Sub ReportErrors(strModuleName)
	If err.number<>0 then Msgbox "An unexpected error occurred. This dialog provides details on the error." & vbCRLF & vbCRLF & "Error Details " & vbCRLF & vbCRLF & "Script Name" & vbTab & Wscript.ScriptFullName & vbCRLF & "Module" & vbtab & vbTab & strModuleName & vbCRLF & "Error Number" & vbTab & err.number & vbCRLF & "Description" & vbTab & err.description, vbCritical + vbOKOnly, "Something unexpected"
	Err.clear
End Sub


Sub VisitSerenity
	If MsgBox("This program came from the Serenity Macros Web Site" & vbCRLF & vbCRLF & "Would you like to visit Serenity's Web Site now?", vbQuestion + vbYesNo + vbDefaultButton2, "Visit Serenity Macros") =6 Then
		sh.Run "http:\\www.angelfire.com\biz\serenitymacros"
	End If
End Sub

Clear Typed URL MRU.vbs

This clears the addresses typed into Explorer or Internet Explorer and asks to open the History folder to delete items from the History list.

'ClearTypedURL.vbs
'Selectively clears individual items from the history for URLs typed into IE.
'
'Serenity Macros 	http://www.angelfire.com/biz/serenitymacros 
'David Candy	davidc@sia.net.au
'
On Error Resume Next
strExplain="ClearTypedURL clears individual items from the history of URLs typed into Internet Explorer." & vbCRLF & "The program will prompt for each item in the list." & vbCRLF & vbCRLF
strTitle="Clear Run MRU"

Dim Sh
Set Sh = WScript.CreateObject("WScript.Shell")
ReportErrors "Creating Shell"
Sh.RegWrite "HKLM\Software\Microsoft\Windows\CurrentVersion\App Paths\" & Wscript.ScriptName & "\", Chr(34) & Wscript.ScriptFullName & Chr(34) 
Sh.RegWrite "HKLM\Software\Microsoft\Windows\CurrentVersion\App Paths\" & Left(Wscript.ScriptName, Len(Wscript.ScriptName)-3) & "exe" & "\", Chr(34) & Wscript.ScriptFullName & Chr(34) 
ReportErrors "Updating App Paths"

NoOfURLs=0
x=1
Do
	t=Sh.RegRead("HKCU\Software\Microsoft\Internet Explorer\TypedURLs\Url" & CStr(x))
	If Err.Number=-2147024894 then 
		Err.Clear
		Exit Do
	Else
		NoOfURLs=NoOfURLs + 1
		x=x+1
	End If
Loop

If MsgBox (strExplain & "Number of entries" & vbtab & NoOfURLs & vbCRLF & vbCRLF & "Continue?", vbYesNo + vbInformation, strTitle) = 6 then
	Dim MRUItem()
	ReDim Preserve MRUItem(0)
	For x=0 to NoOfURLs - 1
		MItem=Sh.RegRead("HKCU\Software\Microsoft\Internet Explorer\TypedURLs\Url" & CStr(x +1))
		Sh.Regdelete "HKCU\Software\Microsoft\Internet Explorer\TypedURLs\Url" & CStr(x + 1)
		If MsgBox ("Do you want to delete " & vbcrlf & vbcrlf & MItem & vbcrlf & vbcrlf & "Yes" & vbtab & "To delete" & vbcrlf & "No" & vbtab & "To keep", vbYesNo + vbQuestion, strTitle) <> 6 then
			ReDim Preserve MRUItem(UBound(MRUItem)+1)
			MRUItem(UBound(MRUItem))=MItem
		End If
	Next
	If UBound(MRUItem) > 0 Then
		For x=1 to UBound(MRUItem)
			Sh.RegWrite "HKCU\Software\Microsoft\Internet Explorer\TypedURLs\Url" & CStr(x),MRUItem(x)
		Next
	End If
	If MsgBox ("Visited URLs are also stored in the History folder. Each item can be deleted there." & vbcrlf & vbcrlf & "Open History folder?", vbYesNo + vbQuestion, strTitle) = 6 then
		Sh.Run "Explorer /e,/root," & Sh.RegRead ("HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Explorer\Shell Folders\History")
	End If
End If

VisitSerenity
ReportErrors(test)

Sub ReportErrors(strModuleName)
	If err.number<>0 then Msgbox "An unexpected error occurred. This dialog provides details on the error." & vbCRLF & vbCRLF & "Error Details " & vbCRLF & vbCRLF & "Script Name" & vbTab & Wscript.ScriptFullName & vbCRLF & "Module" & vbtab & vbTab & strModuleName & vbCRLF & "Error Number" & vbTab & err.number & vbCRLF & "Description" & vbTab & err.description, vbCritical + vbOKOnly, "Something unexpected"
	Err.clear
End Sub


Sub VisitSerenity
	If MsgBox("This program came from the Serenity Macros Web Site" & vbCRLF & vbCRLF & "Would you like to visit Serenity's Web Site now?", vbQuestion + vbYesNo + vbDefaultButton2, "Visit Serenity Macros") =6 Then
		sh.Run "http:\\www.angelfire.com\biz\serenitymacros"
	End If
End Sub