@echo off

SET choice=a

set EXE_FILE=not_defined
if "%PROCESSOR_ARCHITECTURE%" == "AMD64" (
	set ICE_REV=40
) else (
	set ICE_REV=01
)

set EXE_FILE=not_defined
if EXIST ..\..\setup\hpzscr%ICE_REV%.exe SET EXE_FILE=..\..\setup\hpzscr%ICE_REV%.exe
if EXIST hpzscr%ICE_REV%.exe SET EXE_FILE=hpzscr%ICE_REV%.exe
if "%EXE_FILE%" == "not_defined" goto MISSING_SCRUBBER_EXE

set SCRUBBER_DAT_FILE=not_defined
if EXIST ..\..\setup\hpwscr05.dat SET SCRUBBER_DAT_FILE=hpwscr05.dat
if EXIST hpwscr05.dat SET SCRUBBER_DAT_FILE=hpwscr05.dat
if "SCRUBBER_DAT_FILE" == "not_defined" goto MISSING_PRODUCT_SCRUBBER_DATFILE

echo ******************** Executing Level4 CleanUP *********************
echo This cleanup utility will remove the HP Image Zone software and the
echo HP product drivers. Use this utility to remove software if you have a
echo problem using the software and would like to reinstall the software.
echo.
echo Use this LEVEL 4 cleanup if LEVEL 3 cleanup utility did not fix the problem 
echo and you continue to experience software problems with your HP Officejet Pro
echo.
echo LEVEL 4 is the most comprehensive cleanup level and 
echo will remove the HP product drivers, HP Image Zone software 
echo and all HP components installed with your HP Officejet Pro device
echo ********************************************************************
echo.
echo If you chose to UNINSTALL, Please do the following...
echo 1. Unplug the USB cable from the back of your HP Officejet Pro device
echo 2. After the cleanup finishes, restart your computer and wait for Windows 
echo    to start
echo 3. Eject and re-insert the software CD that came with your HP Officejet Pro 
echo    device to start the installation
echo 4. Follow the on-screen instructions to finish the installation
echo 5. Try printing a document to confirm functionality

if Windows_NT==%OS% GOTO WIN2K_XP
GOTO WIN9x_ME

:WIN2K_XP
echo Press ENTER to continue Uninstalling... 
echo              OR 
echo Press Q followed by ENTER to QUIT uninstallation

SET /P Choice=

IF /I ‘%choice:~0,1%’==’Q’ GOTO END_QUIT

GOTO DISPLAY

:WIN9x_ME
choice /C:cq Press Q to quit Uninstall OR press C to continue...
if ERRORLEVEL==2 GOTO END_QUIT
if ERRORLEVEL==1 GOTO DISPLAY

GOTO END_QUIT


:MISSING_SCRUBBER_EXE
echo "**** Uninstall file not found: hpzscr%ICE_REV%.exe ****"
goto EXIT


:DISPLAY
start /w %EXE_FILE% -datfile %SCRUBBER_DAT_FILE% -unattended -showdisconnect -nocopytotemp -noreboot
	
start /w %EXE_FILE% -datfile hpqbud01.dat -unattended -nocopytotemp -noreboot

start /w %EXE_FILE% -datfile hpqbud04.dat -unattended -nocopytotemp -noreboot

start /w %EXE_FILE% -datfile hpqbud05.dat -unattended -nocopytotemp -noreboot

start /w %EXE_FILE% -datfile hpqbud06.dat -unattended -nocopytotemp -noreboot

start /w %EXE_FILE% -datfile hpqbud08.dat -unattended -nocopytotemp -noreboot

start /w %EXE_FILE% -datfile hpqbud11.dat -unattended -nocopytotemp -noreboot

start /w MsiExec.exe /q /X{FE64AE29-0883-4C70-8388-DC026019C900}

start /w MsiExec.exe /q /X{6994491D-D491-48F1-AE1F-E179C1FFFC2F}

start /w MsiExec.exe /q /X{D48AD533-BAD5-469B-A9AA-272C6D80E70B}

start /w %EXE_FILE% -datfile hpqhsc01.dat -unattended -nocopytotemp -noreboot

start %EXE_FILE% -datfile hpwbud07.dat -unattended -nocopytotemp -forcereboot

:END
echo Uninstallation Completed.
:END_QUIT
echo DONE.
pause
goto EXIT

:MISSING_PRODUCT_SCRUBBER_DATFILE
echo "**** Uninstall file not found: hpwscr??.dat ****"
goto EXIT

:MISSING_SCRUBBER_EXE
echo "**** Uninstall file not found: hpzscr%ICE_REV%.exe ****"
goto EXIT

:END
echo Uninstallation Completed.

:END_QUIT
echo DONE.

:EXIT