@echo off
%systemdrive%
rem cd %systemroot%\system32

@echo off
TITLE Communication Device Class USB Driver Installation
VER

ECHO Communication Device Class USB Driver Installation

DATE /T 
TIME /T

SET /A UNINSTALLSTATUS = 0

IF "%PROCESSOR_ARCHITECTURE%"=="AMD64" (GOTO UNINSTALL64)
IF "%PROCESSOR_ARCHITECTURE%"=="x86" (GOTO UNINSTALL32)
IF "%PROCESSOR_ARCHITECTURE%"=="I386" (GOTO UNINSTALL32) ELSE (GOTO UNINSTALL_STATUS)

:UNINSTALL64
ECHO UnInstalling 64bit drivers set
"%~dp0amd64\CInfoEM64.exe" "DriverVer=01/18/2019,1.0.0.12"
"%~dp0amd64\CInfoEM64.exe" "DriverVer=01/24/2019,1.0.0.13"
"%~dp0amd64\CInfoEM64.exe" "DriverVer=03/05/2019,1.0.0.14"
"%~dp0amd64\CInfoEM64.exe" "DriverVer=05/20/2019,1.0.0.15"
"%~dp0amd64\CInfoEM64.exe" "DriverVer=06/03/2019,1.0.0.16"
"%~dp0amd64\CInfoEM64.exe" "DriverVer=06/18/2019,1.0.0.17"
"%~dp0amd64\dcutils.exe" "remove" "USB\VID_041E&PID_6007&MI_01"
"%~dp0amd64\dcutils.exe" "remove" "USB\VID_041E&PID_3253&MI_01"
"%~dp0amd64\dcutils.exe" "remove" "USB\VID_041E&PID_3258&MI_01"
"%~dp0amd64\dcutils.exe" "remove" "USB\VID_041E&PID_3262&MI_01"
"%~dp0amd64\dcutils.exe" "remove" "USB\VID_041E&PID_3264&MI_01"

"%~dp0amd64\dcutils.exe" "rescan" "*"

SET /A UNINSTALLSTATUS = 1
GOTO UNINSTALL_STATUS

:UNINSTALL32
ECHO UnInstalling 32bit drivers set
"%~dp0i386\CInfoEM32.exe" "DriverVer=01/18/2019,1.0.0.12"
"%~dp0i386\CInfoEM32.exe" "DriverVer=01/24/2019,1.0.0.13"
"%~dp0i386\CInfoEM32.exe" "DriverVer=03/05/2019,1.0.0.13"
"%~dp0i386\CInfoEM32.exe" "DriverVer=03/05/2019,1.0.0.14"
"%~dp0i386\CInfoEM32.exe" "DriverVer=05/20/2019,1.0.0.15"
"%~dp0i386\CInfoEM32.exe" "DriverVer=06/03/2019,1.0.0.16"
"%~dp0i386\CInfoEM32.exe" "DriverVer=06/18/2019,1.0.0.17"
"%~dp0i386\dcutils.exe" "remove" "USB\VID_041E&PID_6007&MI_01"
"%~dp0i386\dcutils.exe" "remove" "USB\VID_041E&PID_3253&MI_01"
"%~dp0i386\dcutils.exe" "remove" "USB\VID_041E&PID_3258&MI_01"
"%~dp0i386\dcutils.exe" "remove" "USB\VID_041E&PID_3262&MI_01"
"%~dp0i386\dcutils.exe" "remove" "USB\VID_041E&PID_3264&MI_01"

"%~dp0i386\dcutils.exe" "rescan" "*"

SET /A UNINSTALLSTATUS = 1
GOTO UNINSTALL_STATUS


:UNINSTALL_STATUS
IF %UNINSTALLSTATUS%==1 (GOTO UNINSTALLSUCCESS) ELSE (GOTO UNINSTALLFAIL)


:UNINSTALLSUCCESS
ECHO 
ECHO "+=====================================================================+"
ECHO "|                                                                     |"
ECHO "|                    UnInstallation Successful!                       |"
ECHO "|                                                                     |"
ECHO "+=====================================================================+"
GOTO END


:UNINSTALLFAIL
ECHO 
ECHO "+=====================================================================+"
ECHO "|                    UnInstallation Unsuccessful!                     |"
ECHO "|                                                                     |"
ECHO "|                                                                     |"
ECHO "+=====================================================================+"
GOTO END

:END
ECHO "+======================================================================+"
ECHO "|                                                                      |"
ECHO "| Please reboot your system in order for your changes to be effective. |"
ECHO "|                                                                      |"
ECHO "+======================================================================+"

