@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 "PCI\VEN_8086&DEV_2723"
IF %ERRORLEVEL%==0 (SET HWVAR="PCI\VEN_8086&DEV_2723") & GOTO :DEV1
.\LBGHWIDCHK.EXE "PCI\VEN_10EC&DEV_B852"
IF %ERRORLEVEL%==0 (SET HWVAR="PCI\VEN_10EC&DEV_B852") & GOTO :DEV2
GOTO :NONHWID

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

:DEV2
SET PACKAGENAME=RTK_WLAN
SET VERSION=6001.15.119.0
SET INSTALLFOLDER=RTK_WLAN
SET BACKUPFOLDER=RTK_WLAN
SET SILIENTCMD=Install.bat
SET PACKAGEID=RTK_WLAN
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