@echo off
@echo Installing Intel Bluetooth Driver...

cd /d "%~dp0"

cacls.exe "%SystemDrive%\System Volume Information" >nul 2>nul

if %errorlevel%==0 goto Admin

if exist "%temp%\getadmin.vbs" del /f /q "%temp%\getadmin.vbs"

echo Set RequestUAC = CreateObject^("Shell.Application"^)>"%temp%\getadmin.vbs"

echo RequestUAC.ShellExecute "%~s0","","","runas",1 >>"%temp%\getadmin.vbs"

echo WScript.Quit >>"%temp%\getadmin.vbs"
"%temp%\getadmin.vbs" /f

if exist "%temp%\getadmin.vbs" del /f /q "%temp%\getadmin.vbs"

exit

:Admin

devcon find @USB\VID_8087*PID_0029* | find /N "No matching"
if %ERRORLEVEL%==1  goto CCP
devcon find @USB\VID_8087*PID_0026* | find /N "No matching"
if %ERRORLEVEL%==1  goto HRP

goto end0

:CCP
  pnputil -a "%~dp0\CCP\ibtusb.inf" /install
  @echo Installation finished
goto end

:HRP
  pnputil -a "%~dp0\HRP\ibtusb.inf" /install
  @echo Installation finished
goto end

:end
ECHO Install Finish!!
goto end1

:end0
echo "No Matched Bluetooth Device In This System." 

:end1