@echo off

color 07


echo.
echo.

rem ##### install ElinkMysql #####


sc config ElinkMysql    start= disabled
net stop ElinkMysql   
timeout /T 2
sc delete  ElinkMysql

%~d0
cd %~dp0
echo %~dp0

rd /s/q "C:\Program Files\ELinkMysql"

unzip.exe -d "C:\Program Files" ELinkMysql.zip

c:
cd "C:\Program Files\ELinkMysql"

"C:\Program Files\ELinkMysql\bin\mysqld.exe" -install ElinkMysql
if not errorlevel 0 goto fail

net start ElinkMysql

%~d0
cd %~dp0
echo %~dp0
cd ELinkService
call InstallService.cmd

rem inatall update service
%~d0
cd %~dp0
echo %~dp0
cd ELinkUpdate
echo %~dp0
call InstallService.cmd

color 07
rem cls
echo.
echo.
echo *************************************
echo.
echo    Install Success
echo.
echo.
echo *************************************

pause
goto end
:fail
rem cls
color 4f
echo.
echo.
echo *************************************
echo.
echo    Install  failed
echo.
echo *************************************
echo.
pause



:end
