@echo off

set uaccheck=0

:CheckUAC
>nul 2>&1 "%SYSTEMROOT%\system32\cacls.exe" "%SYSTEMROOT%\system32\config\system"
if '%errorlevel%' NEQ '0' ( goto UACAccess ) else ( goto DEPLOY )

:UACAccess
echo Set UAC = CreateObject^("Shell.Application"^) > "%temp%\uac_get_admin.vbs"
set params = %*:"=""
echo UAC.ShellExecute "cmd.exe", "/c %~s0 %params%", "", "runas", 1 >> "%temp%\uac_get_admin.vbs"
"%temp%\uac_get_admin.vbs"
del "%temp%\uac_get_admin.vbs"
exit /b


:DEPLOY
chcp 949
color 9F
pushd %~dp0
cls

echo Start Installing Intel 7265 BT driver...
@set L=C:\Windows\temp\Driver_install.log
@set L2=C:\Windows\temp\Driver_install_wlan_bt.logs
@set IP=[********Install Pass********]
@set IPR=[********Install Pass, Restart is need********]
@set IF=[********Install Fail********]

@echo. > %L2%
@echo [%time%]=========Install Intel AC7265 BT driver========= >> %L%
@echo [%time%]=========Install Intel AC7265 BT driver========= >> %L2%
pnputil /add-driver "%~dp0Drivers\*.inf" /install >> %L%

@set value=%errorlevel%
@if %errorlevel%==0 (echo [%time%]%IP% >> %L% & echo [%time%]%IP% >> %L2% & set value=0)
@if %errorlevel%==259 (echo [%time%]%errorlevel% >> %L% & set value=0)
@if %errorlevel%==3010 (echo [%time%]%IPR% >> %L% & echo [%time%]%IPR% >> %L2% & set value=0)
@if not %value%==0 (echo [%time%]%IF% >> %L% & echo [%time%]%IF% >> %L2% & echo. >> %L2% & type %L2% & pause & exit /b 1)
@echo [%time%]=========Intel AC7265 BT driver Install Complete========= >> %L%
@echo [%time%]=========Intel AC7265 BT driver Install Complete========= >> %L2%
@echo. >> %L2%

type %L2%
pause