SurlyJake Blog

Uninstall ALL Versions of WinZip Batch Script

| Comments

I have been struggling with this for quite a while, and ran into a lot of issues with all of the different versions on our network. There are people with 100 line .vbs scripts to do this, and I think this is much simpler:

@echo off
REM
REM
REM    Detects winzip and silently uninstalls
REM    There is a un-stoppable pop-up window. so this will kill
REM    all instances of  IE after the UN-installation.
REM
REM
REM
taskkill /F /IM wzqkpick.exe
wmic product where "name like '%%winzip%%'" call Uninstall
REM
REM This section is for WinZip <12
REM
If Exist "%programfiles(x86)%\Winzip\winzip32.exe" GOTO 64
If Exist "%programfiles%\Winzip\winzip32.exe" "%programfiles%\WinZip\Winzip32.exe" /Uninstallx
taskkill /F /IM iexplore.exe
GOTO :END
:64
"%programfiles(x86)%\WinZip\Winzip32.exe" /Uninstallx
taskkill /F /IM iexplore.exe
:END

For getting rid of WinZip 12, the magic happens in the ‘wmic’ line. It searches all of the installed product’s names for “winzip” and will uninstall anything it finds. This only works for products that use MSI’s. If you ran this outside of a batch file, you will have to use a single % percentage sign instead of the %% double percentage sign… Windows scripting sucks, and that’s just the way it is. Same thing that happens in “FOR” loops.

I never knew anything about the Windows management instrumentation control (wmic) until now, but I will be sure to exploit it’s features.

Comments