My systems always seem to have excess service pack and hotfix uninstall folders, and registry entries, mostly from my participation in the betas.

Prior to installing a new service pack release, I use DelHotFix.bat to delete all previous service pack and hotfix uninstall folders, and the Control Panel / Add or Remove Programs registry entries.

NOTE: I am NOT recommending that you do this, but you could run the DelHotFix.bat in display mode.

The syntax for using DelHotFix.bat is:

DelHotFix \[/D\]

Where /D is an optional switch that causes the folder and registry key deletion.

DelHotFix.bat contains:

@echo off                              setlocal                              @echo DelHotFix \[/D\]                              set sw=%1                              set key=HKLM\SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall                              set blank=                               set fnd=findstr /L /I                              for /f "Tokens=*" %%a in ('reg query %key% ^|%fnd% /C:"\Uninstall\KB"') do (                               set UK=%%a                               call :parse                              )                              for /f "Tokens=*" %%a in ('reg query %key% ^|%fnd% /C:"\Uninstall\Q0"') do (                               set UK=%%a                               call :parse                              )                              for /f "Tokens=*" %%a in ('reg query %key% ^|%fnd% /C:"\Uninstall\Q8"') do (                               set UK=%%a                               call :parse                              )                              set key="HKLM\SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\Windows 2000 Service Pack"                              call :SP                              set key="HKLM\SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\Windows XP Service Pack"                              call :SP                              set key="HKLM\SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\Windows Server 2003 Service Pack"                              call :SP                              if /i "%sw%" NEQ "/D" dir /b /a /ad "%SystemRoot%\$NT*"                              if /i "%sw%" NEQ "/D" goto finish                              for /f "Tokens=*" %%d in ('dir /b /a /ad "%SystemRoot%\$NT*"') do (                               @echo Deleting "%SystemRoot%\%%d"                               rd /s /q "%SystemRoot%\%%d"                              )                              :finish                              endlocal                              goto :EOF                              :parse                              set UK=HKLM%UK:~18%                              for /f "Tokens=2*" %%b in ('reg Query "%UK%" /v DisplayName') do (                               set name=%%c                              )                              if /i "%sw%" NEQ "/D" @echo %UK% %blank% %blank% %name%                              if /i "%sw%" NEQ "/D" goto :EOF                              @echo REG DELETE %UK% /F                              REG DELETE %UK% /F                              @echogoto :EOF                              :SP                              set OK=N                              call :SPX>nul 2>&1                              if "%OK%" EQU "N" goto :EOF                              if /i "%sw%" NEQ "/D" @echo %key%&goto :EOF                              set UK=%key%                              @echo REG DELETE %UK% /F                              REG DELETE %UK% /F                              @echogoto :EOF                              :SPX                              for /f "Tokens=*" %%a in ('reg query %key%') do (                               set OK=Y                              )