@echo off
set PRDID={D2FFE22E-60D8-4DE5-9B6D-D54A586A4E2D}
set PGM=PowerclassPen
tasklist /fi "imagename eq %PGM%.exe" |find ":" > nul
if errorlevel 1 taskkill /f /im "%PGM%.exe" 1>nul 2>nul
if errorlevel 1 (goto NoticeKill) else (goto Label001)
:NoticeKill
echo Please kill application %PGM%.exe and then try again.
pause
goto Label999
:Label001
set q=%9
net session >nul 2>&1
set er=%ERRORLEVEL%
::echo %er%
::@pause
if %er% == 2 goto not_admin
set q=/quiet
:not_admin
echo %PGM% program will be uninstalled.
MsiExec.exe %q% /x %PRDID%

echo Uninstall completed.

echo Program update...

if exist "Office2007PIARedist" goto LB_SETUP
goto LB_MSI
:LB_SETUP
::echo "setup.exe"
setup.exe
goto LB_SETUP_ALL
:LB_MSI
::echo "msi"
MsiExec /i %PGM%.msi
:LB_SETUP_ALL
echo ***********************************
echo   %PGM% Update Completed.
echo ***********************************
::@ping 127.0.0.1 -w 1 1>NUL 2>NUL
:Label999
