@echo off
if exist "%SystemRoot%\SysWOW64" path %path%;%windir%\SysNative;%SystemRoot%\SysWOW64;%~dp0
bcdedit >nul
if '%errorlevel%' NEQ '0' (goto UACPrompt) else (goto UACAdmin)
:UACPrompt
%1 start "" mshta vbscript:createobject("shell.application").shellexecute("""%~0""","::",,"runas",1)(window.close)&exit
exit /B
:UACAdmin
cd /d "%~dp0"



.\LBGHWIDCHK.EXE "USB\VID_27C6&PID_589A"
IF %ERRORLEVEL%==0 (SET HWVAR="USB\VID_27C6&PID_589A") & GOTO :DEV1
.\LBGHWIDCHK.EXE "USB\VID_10A5&PID_9201"
IF %ERRORLEVEL%==0 (SET HWVAR="USB\VID_10A5&PID_9201") & GOTO :DEV2
GOTO :NONHWID

:DEV1
SET PACKAGENAME=Goodix_FP
SET VERSION=3.0.83.120
SET INSTALLFOLDER=Goodix_FP
SET BACKUPFOLDER=Goodix_FP
SET SILIENTCMD=Install.cmd
SET PACKAGEID=Goodix_FP
SET OS=WIN1064
SET MODTYPE=DRIVER
SET RecLog=.\MODULES.LOG
PUSHD "%~DP0%INSTALLFOLDER%\"
GOTO :INSTALL

:DEV2
SET PACKAGENAME=FPC_FP
SET VERSION=21.26.2.27
SET INSTALLFOLDER=FPC_FP
SET BACKUPFOLDER=FPC_FP
SET SILIENTCMD=Install.cmd
SET PACKAGEID=FPC_FP
SET OS=WIN1064
SET MODTYPE=DRIVER
SET RecLog=.\MODULES.LOG
PUSHD "%~DP0%INSTALLFOLDER%\"
GOTO :INSTALL

:INSTALL

ECHO %DATE% %TIME% START TO INSTALL (%PACKAGENAME%) >> %RecLog%
ECHO %DATE% %TIME% INSTALL FROM : "%~DP0%INSTALLFOLDER%\"   >> %RecLog%
ECHO %DATE% %TIME% SILIENT INSTALL CMD : %SILIENTCMD%   >> %RecLog%
CALL %SILIENTCMD%
IF %ERRORLEVEL% == 0 ( ECHO %MODTYPE%_%PACKAGEID%_[INFO]=%DATE% %TIME% DRIVER %PACKAGENAME% HAS BEEN INSTALL SUCCEFULLY!!! >> %RecLog%
) ELSE (
 ECHO %MODTYPE%_%PACKAGEID%_[INFO]=%DATE% %TIME% DRIVER %PACKAGENAME% INSTALL FAILED,BAD RETURN EXIT WITH %ERRORLEVEL% >> %RecLog%
)
GOTO END


:NONHWID
ECHO %MODTYPE%_%PACKAGEID%_[INFO]=%DATE% %TIME% NOT FOUND ANY MATCHED DEVICE ID,SOURCE HAVEN'T BEEN INSTALLED 
GOTO END

:END
ECHO %DATE% %TIME% FINISHED INSTALLING (%PACKAGEID%) (%PACKAGENAME%)
POPD