REM==>MyCompDrUninstall.bat

@Echo off
cls

REM==>See if this batch file is being started from the MyCompDrBackup folder
REM==>If it is, terminate the batch file since problems are inherent running it from MyCompDrBackup folder
set workingdir=%~dp0

REM==>NOT MyCompDrBackup folder so proceed
if NOT "%workingdir%"=="C:\MyCompDrBackup\" goto START

REM==>IS MyCompDrBackup folder so terminate
if "%workingdir%"=="C:\MyCompDrBackup\" goto ABORT

:ABORT
Echo.
Echo.
Echo This program cannot be run from here...Aborting batch!
Echo.
pause
goto END

:START
cls
Echo.
Echo Please wait!
Echo.
Echo Do NOT close this window!
Echo.
Echo Thank you!

:DEL_BACKUP
REM==>Delete the MyCompDrBackup files and the directory
REM==>Check if the MyCompDrBackup exists and if it does, delete the files and directory

if NOT exist "C:\MyCompDrBackup" goto DEL_DESKTOP_SHORTCUT

REM==> Tell user the MyComputerDr backup folder is being deleted.

Echo.
Echo Deleting the MyComputerDr backup files and folder...
Echo.

del /f /q C:\MyCompDrBackup\*.*
rmdir /s /q C:\MyCompDrBackup

:DEL_DESKTOP_SHORTCUT
if exist "%UserProfile%\Desktop\MyComputerDr.lnk" goto DEL_SHORTCUT
goto DEL_MAIN

:DEL_SHORTCUT
del /f /q %UserProfile%\Desktop\MyComputerDr.lnk
goto DEL_MAIN

:DEL_MAIN
cd C:\

REM==============================>32-bit
REM==> For 32-bit systems. Check if MyComputerDr is installed
if exist "C:\Program Files\MyComputerDr" goto DEL_EXE1
REM==>Not 32-bit so go to the 64-bit routine
if not exist "C:\Program Files\MyComputerDr" goto IS_64BIT

:DEL_EXE1
REM==>See if VB uninstall program exists in the Windows directory
REM==>If it does not exist, notify the user it's can't be found
if not exist "%windir%\st5unst.exe" goto NO_ST5UNST

REM==>See if the uninstall log files exists in the MyComputerDr directory
REM==>If it does not exist, notify the user it's can't be found
if not exist "C:\Program Files\MyComputerDr\st5unst.log" goto NO_UNSTLOG

REM==>Run the VB uninstall program
Echo.
Echo Running the MyComputerDr uninstall program. Please wait!
Echo.
%windir%\st5unst.exe -n "C:\Program Files\MyComputerDr\st5unst.log" -f -q

REM==>Program is uninstalled.  Now go and delete the backup directory
goto END

REM==============================>64-bit
REM==> For 64-bit systems	

:IS_64BIT
if exist "C:\Program Files (x86)\MyComputerDr" goto DEL_EXE2
if not exist "C:\Program Files (x86)\MyComputerDr" goto DEL_BACKUP

:DEL_EXE2
REM==>See if VB uninstall program exists in the Windows directory
REM==>If it does not exist, notify the user it's can't be found
if not exist "%windir%\st5unst.exe" goto NO_ST5UNST

REM==>See if the uninstall log files exists in the MyComputerDr directory
REM==>If it does not exist, notify the user it's can't be found
if not exist "C:\Program Files (x86)\MyComputerDr\st5unst.log" goto NO_UNSTLOG

REM==>Run the VB uninstall program
Echo.
Echo Running the MyComputerDr uninstall program. Please wait!
Echo.
%windir%\st5unst.exe -n "C:\Program Files (x86)\MyComputerDr\st5unst.log" -f -q

REM==>Program is uninstalled. Now terminate the batch file.
goto END

:NO_ST5UNST
REM==>If the client calls, copy st5unst.exe from the MyCompDtBackup directory to C:\Windows
REM==>Change the attribute ReadOnly to off after copying
cls
Echo.
Echo The uninstall program file cannot be found!
Echo.
Echo Please call Keith at 303-937-3987
Echo.
Echo Thank you!
Echo.
Pause
goto END

:NO_UNSTLOG
REM==>If the client calls, copy st5unst.log from the MyCompDtBackup directory to C:\Program Files\MyComputerDr
REM==>Change the attribute ReadOnly to off after copying
cls
Echo.
Echo The uninstall log file cannot be found!
Echo.
Echo Please call Keith at 303-937-3987
Echo.
Echo Thank you!
Echo.
Pause
goto END

:END
exit
